alsa.audio: drop remaining buffer when closing
[AROS.git] / compiler / stdc / __ctype_linklib.c
blob14a0775c08646c2c00e1e60b783bbf71b059b271
1 /*
2 Copyright © 2012-2013, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/symbolsets.h>
8 #include <proto/exec.h>
9 #include <libraries/stdc.h>
11 const unsigned short int * const *__ctype_b_ptr = NULL;
12 const unsigned char * const *__ctype_toupper_ptr = NULL;
13 const unsigned char * const *__ctype_tolower_ptr = NULL;
15 static struct StdCBase *_StdCBase;
16 static int opened = 0;
18 static int __ctype_init(struct ExecBase *SysBase)
20 _StdCBase = __aros_getbase_StdCBase();
21 /* Be sure ctype functions may be called from init code.
22 * If library is using relbase version of stdc.library it will
23 * only open stdc.library during OpenLib and _StdCBase may
24 * be NULL at this point.
25 * Try to open stdc.library manually here
27 if (!_StdCBase)
29 _StdCBase = (struct StdCBase *)OpenLibrary("stdc.library", 0);
30 opened = 1;
32 if (!_StdCBase)
33 return 0;
35 __ctype_b_ptr = &_StdCBase->__ctype_b;
36 __ctype_toupper_ptr = &_StdCBase->__ctype_toupper;
37 __ctype_tolower_ptr = &_StdCBase->__ctype_tolower;
39 return 1;
42 static void __ctype_exit(void)
44 if (opened && _StdCBase)
45 CloseLibrary((struct Library *)_StdCBase);
48 ADD2INIT(__ctype_init, 20);
49 ADD2EXIT(__ctype_exit, 20);