* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: name.c,v 1.152 2005/09/09 06:13:59 marka Exp $ */
+/* $Id: name.c,v 1.153 2005/09/10 00:31:25 marka Exp $ */
/*! \file */
*/
#ifdef ISC_PLATFORM_USETHREADS
static isc_thread_key_t totext_filter_proc_key;
+static isc_once_t once = ISC_ONCE_INIT;
#else
static dns_name_totextfilter_t totext_filter_proc = NULL;
#endif
return (ISC_R_SUCCESS);
}
+#ifdef ISC_PLATFORM_USETHREADS
+static void
+totext_filter_proc_key_init(void) {
+ RUNTIME_CHECK(isc_key_create(&totext_filter_proc_key, NULL) == 0);
+}
+#endif
+
isc_result_t
dns_name_totext(dns_name_t *name, isc_boolean_t omit_final_dot,
isc_buffer_t *target)
unsigned int oused = target->used;
#ifdef ISC_PLATFORM_USETHREADS
dns_name_totextfilter_t totext_filter_proc;
+ isc_result_t result;
#endif
/*
REQUIRE(VALID_NAME(name));
REQUIRE(ISC_BUFFER_VALID(target));
+#ifdef ISC_PLATFORM_USETHREADS
+ result = isc_once_do(&once, totext_filter_proc_key_init);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
ndata = name->ndata;
nlen = name->length;
labels = name->labels;
return (ISC_R_SUCCESS);
}
-#ifdef ISC_PLATFORM_USETHREADS
-static void
-totext_filter_proc_key_init(void) {
- RUNTIME_CHECK(isc_key_create(&totext_filter_proc_key, NULL) == 0);
-}
-#endif
-
isc_result_t
dns_name_settotextfilter(dns_name_totextfilter_t proc) {
#ifdef ISC_PLATFORM_USETHREADS
- static isc_once_t once = ISC_ONCE_INIT;
isc_result_t result;
result = isc_once_do(&once, totext_filter_proc_key_init);