2 Copyright © 1995-2011, 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.
46 *****************************************************************************/
50 /* Best make sure we actually have something freeable. */
52 && (locale
!= (struct Locale
*)IntLB(LocaleBase
)->lb_DefaultLocale
))
54 /* Make sure we don't have any race conditions */
55 ObtainSemaphore(&IntLB(LocaleBase
)->lb_LocaleLock
);
56 if (--IntL(locale
)->il_Count
== 0)
58 /* Free the locale structure if it's not the current locale */
60 (struct Locale
*)IntLB(LocaleBase
)->lb_CurrentLocale
)
62 /* Close old .language, if any */
63 if (IntLB(locale
)->lb_CurrentLocale
->il_CurrentLanguage
)
64 CloseLibrary(IntLB(locale
)->lb_CurrentLocale
->
67 /* Close old dos.catalog */
68 CloseCatalog(IntLB(locale
)->lb_CurrentLocale
->
71 FreeMem(locale
, sizeof(struct IntLocale
));
74 ReleaseSemaphore(&IntLB(LocaleBase
)->lb_LocaleLock
);