diff options
Diffstat (limited to 'lib/isc/result.c')
-rw-r--r-- | lib/isc/result.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lib/isc/result.c b/lib/isc/result.c index 571358054e8f..520f1613acd1 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.c,v 1.71 2008/09/25 04:02:39 tbox Exp $ */ +/* $Id$ */ /*! \file */ @@ -102,6 +102,7 @@ static const char *text[ISC_R_NRESULTS] = { "max size", /*%< 58 */ "invalid address format", /*%< 59 */ "bad base32 encoding", /*%< 60 */ + "unset", /*%< 61 */ }; #define ISC_RESULT_RESULTSET 2 @@ -112,14 +113,14 @@ static ISC_LIST(resulttable) tables; static isc_mutex_t lock; static isc_result_t -register_table(unsigned int base, unsigned int nresults, const char **text, +register_table(unsigned int base, unsigned int nresults, const char **txt, isc_msgcat_t *msgcat, int set) { resulttable *table; REQUIRE(base % ISC_RESULTCLASS_SIZE == 0); REQUIRE(nresults <= ISC_RESULTCLASS_SIZE); - REQUIRE(text != NULL); + REQUIRE(txt != NULL); /* * We use malloc() here because we we want to be able to use @@ -130,7 +131,7 @@ register_table(unsigned int base, unsigned int nresults, const char **text, return (ISC_R_NOMEMORY); table->base = base; table->last = base + nresults - 1; - table->text = text; + table->text = txt; table->msgcat = msgcat; table->set = set; ISC_LINK_INIT(table, link); @@ -170,14 +171,14 @@ initialize(void) { const char * isc_result_totext(isc_result_t result) { resulttable *table; - const char *text, *default_text; + const char *txt, *default_text; int index; initialize(); LOCK(&lock); - text = NULL; + txt = NULL; for (table = ISC_LIST_HEAD(tables); table != NULL; table = ISC_LIST_NEXT(table, link)) { @@ -189,25 +190,25 @@ isc_result_totext(isc_result_t result) { * instead of index because isc_msgcat_get() requires * the message number to be > 0. */ - text = isc_msgcat_get(table->msgcat, table->set, - index + 1, default_text); + txt = isc_msgcat_get(table->msgcat, table->set, + index + 1, default_text); break; } } - if (text == NULL) - text = isc_msgcat_get(isc_msgcat, ISC_RESULT_UNAVAILABLESET, - 1, "(result code text not available)"); + if (txt == NULL) + txt = isc_msgcat_get(isc_msgcat, ISC_RESULT_UNAVAILABLESET, + 1, "(result code text not available)"); UNLOCK(&lock); - return (text); + return (txt); } isc_result_t isc_result_register(unsigned int base, unsigned int nresults, - const char **text, isc_msgcat_t *msgcat, int set) + const char **txt, isc_msgcat_t *msgcat, int set) { initialize(); - return (register_table(base, nresults, text, msgcat, set)); + return (register_table(base, nresults, txt, msgcat, set)); } |