grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / locale / closecatalog.c
blobb1e3d5a03163700e4bb373e95631ead86fb8c146
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Close a message catalog.
6 Lang: english
7 */
8 #include <exec/types.h>
9 #include <proto/exec.h>
10 #include "locale_intern.h"
12 #define DEBUG_CLOSECATALOG(x) ;
14 /*****************************************************************************
16 NAME */
17 #include <proto/locale.h>
19 AROS_LH1(void, CloseCatalog,
21 /* SYNOPSIS */
22 AROS_LHA(struct Catalog *, catalog, A0),
24 /* LOCATION */
25 struct LocaleBase *, LocaleBase, 6, Locale)
27 /* FUNCTION
28 Conclude access to a message catalog, and decrement the use count.
29 If this use count is 0, the catalog can be expunged when the
30 system memory is running low.
32 INPUTS
33 catalog - the message catalog to close, note that NULL is
34 a valid catalog.
36 RESULT
37 The catalog is closed, and should no longer be used by the
38 application.
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 GetCatalogStr(), OpenCatalogA()
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 DEBUG_CLOSECATALOG(dprintf("CloseCatalog: catalog 0x%lx\n",
56 catalog));
58 if (catalog != NULL)
60 ObtainSemaphore(&IntLB(LocaleBase)->lb_CatalogLock);
62 /* Decrement the use counter. */
63 IntCat(catalog)->ic_UseCount--;
65 if (0 == IntCat(catalog)->ic_UseCount)
67 Remove(&catalog->cat_Link);
69 dispose_catalog((struct IntCatalog *)catalog, LocaleBase);
70 FreeVec(catalog);
73 ReleaseSemaphore(&IntLB(LocaleBase)->lb_CatalogLock);
77 DEBUG_CLOSECATALOG(dprintf("CloseCatalog: done\n"));
79 AROS_LIBFUNC_EXIT