Some small cleanups.
[wine/multimedia.git] / library / errno.c
blobbd67b97ea51ea68ec0da374125145ea480ab79a3
1 /*
2 * Wine library reentrant errno support
4 * Copyright 1998 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 /* default errno before threading is initialized */
24 static int *default_errno_location(void)
26 static int errno;
27 return &errno;
30 /* default h_errno before threading is initialized */
31 static int *default_h_errno_location(void)
33 static int h_errno;
34 return &h_errno;
37 int* (*wine_errno_location)(void) = default_errno_location;
38 int* (*wine_h_errno_location)(void) = default_h_errno_location;
40 /***********************************************************************
41 * __errno_location/__error/___errno
43 * Get the per-thread errno location.
45 #ifdef ERRNO_LOCATION
46 int *ERRNO_LOCATION(void)
48 return wine_errno_location();
50 #endif /* ERRNO_LOCATION */
52 /***********************************************************************
53 * __h_errno_location
55 * Get the per-thread h_errno location.
57 int *__h_errno_location(void)
59 return wine_h_errno_location();