add casts to zune macros to silence some warnings
[tangerine.git] / workbench / libs / locale / closelocale.c
blob76dda64dff37d55c31380552dda1fa7f0305a1df
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CloseLocale() - Close a locale structure.
6 Lang: english
7 */
8 #include <exec/types.h>
9 #include <proto/exec.h>
10 #include "locale_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/locale.h>
17 AROS_LH1(void, CloseLocale,
19 /* SYNOPSIS */
20 AROS_LHA(struct Locale *, locale, A0),
22 /* LOCATION */
23 struct LocaleBase *, LocaleBase, 7, Locale)
25 /* FUNCTION
26 Finish accessing a Locale.
28 INPUTS
29 locale - An opened locale. Note that NULL is a valid
30 parameter here, and will simply be ignored.
32 RESULT
33 The locale is released back to the system.
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 OpenLocale()
44 INTERNALS
46 HISTORY
47 27-11-96 digulla automatically created from
48 locale_lib.fd and clib/locale_protos.h
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
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);
77 AROS_LIBFUNC_EXIT
78 } /* CloseLocale */