PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/bind9/lib/isccc/lib.c

https://bitbucket.org/freebsd/freebsd-head/
C | 78 lines | 16 code | 17 blank | 45 comment | 1 complexity | 7a50715cd3c7322b067398f81cfc2643 MD5 | raw file
 1/*
 2 * Portions Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
 3 * Portions Copyright (C) 2001  Internet Software Consortium.
 4 *
 5 * Permission to use, copy, modify, and/or distribute this software for any
 6 * purpose with or without fee is hereby granted, provided that the above
 7 * copyright notice and this permission notice appear in all copies.
 8 *
 9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
11 * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
12 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 *
17 * Portions Copyright (C) 2001  Nominum, Inc.
18 *
19 * Permission to use, copy, modify, and/or distribute this software for any
20 * purpose with or without fee is hereby granted, provided that the above
21 * copyright notice and this permission notice appear in all copies.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
24 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
26 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
28 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30 */
31
32/* $Id: lib.c,v 1.9 2007/08/28 07:20:43 tbox Exp $ */
33
34/*! \file */
35
36#include <config.h>
37
38#include <stddef.h>
39
40#include <isc/once.h>
41#include <isc/msgcat.h>
42#include <isc/util.h>
43
44#include <isccc/lib.h>
45
46/***
47 *** Globals
48 ***/
49
50LIBISCCC_EXTERNAL_DATA isc_msgcat_t *		isccc_msgcat = NULL;
51
52
53/***
54 *** Private
55 ***/
56
57static isc_once_t		msgcat_once = ISC_ONCE_INIT;
58
59
60/***
61 *** Functions
62 ***/
63
64static void
65open_msgcat(void) {
66	isc_msgcat_open("libisccc.cat", &isccc_msgcat);
67}
68
69void
70isccc_lib_initmsgcat(void) {
71
72	/*
73	 * Initialize the DNS library's message catalog, isccc_msgcat, if it
74	 * has not already been initialized.
75	 */
76
77	RUNTIME_CHECK(isc_once_do(&msgcat_once, open_msgcat) == ISC_R_SUCCESS);
78}