2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: CloseLocale() - Close a locale structure.
8 #include <exec/types.h>
9 #include <proto/exec.h>
10 #include "locale_intern.h"
12 /*****************************************************************************
15 #include <proto/locale.h>
17 AROS_LH1(void, CloseLocale
,
20 AROS_LHA(struct Locale
*, locale
, A0
),
23 struct LocaleBase
*, LocaleBase
, 7, Locale
)
26 Finish accessing a Locale.
29 locale - An opened locale. Note that NULL is a valid
30 parameter here, and will simply be ignored.
33 The locale is released back to the system.
47 27-11-96 digulla automatically created from
48 locale_lib.fd and clib/locale_protos.h
50 *****************************************************************************/
54 /* Best make sure we actually have something freeable. */
55 if(locale
&& (locale
!= (struct Locale
*)IntLB(LocaleBase
)->lb_DefaultLocale
))
57 /* Make sure we don't have any race conditions */
58 ObtainSemaphore(&IntLB(LocaleBase
)->lb_LocaleLock
);
59 if(--IntL(locale
)->il_Count
== 0)
61 /* Free the locale structure if it's not the current locale */
62 if (locale
!= (struct Locale
*)IntLB(LocaleBase
)->lb_CurrentLocale
)
64 /* Close old .language, if any */
65 if (IntLB(locale
)->lb_CurrentLocale
->il_CurrentLanguage
)
66 CloseLibrary(IntLB(locale
)->lb_CurrentLocale
->il_CurrentLanguage
);
68 /* Close old dos.catalog */
69 CloseCatalog(IntLB(locale
)->lb_CurrentLocale
->il_DosCatalog
);
71 FreeMem(locale
, sizeof(struct IntLocale
));
74 ReleaseSemaphore(&IntLB(LocaleBase
)->lb_LocaleLock
);