2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 15:45:25 +00:00

NBUF was one to small.

GETTOKEN is now a simple macro that calls gettoken (static inline).
This commit is contained in:
Mark Andrews
1999-03-23 00:04:01 +00:00
parent dd082cc554
commit 0d46301a6e

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: master.c,v 1.14 1999/03/22 06:21:29 marka Exp $ */ /* $Id: master.c,v 1.15 1999/03/23 00:04:01 marka Exp $ */
#include <config.h> #include <config.h>
@@ -51,7 +51,7 @@
#define RDLSZ 32 #define RDLSZ 32
#define RDSZ 512 #define RDSZ 512
#define NBUFS 3 #define NBUFS 4
#define MAXWIRESZ 255 #define MAXWIRESZ 255
/* /*
@@ -83,39 +83,52 @@ static isc_boolean_t on_list(dns_rdatalist_t *this, dns_rdata_t *rdata);
#define GETTOKEN(lexer, options, token, eol) \ #define GETTOKEN(lexer, options, token, eol) \
do { \ do { \
unsigned int isc_o; \ dns_result_t isc_r; \
isc_result_t isc_r; \ isc_r = gettoken(lexer, options, token, eol, \
isc_token_t *isc_t = (token); \ master_file, callbacks); \
isc_o = (options) | ISC_LEXOPT_EOL | ISC_LEXOPT_EOF | \
ISC_LEXOPT_DNSMULTILINE; \
isc_r = isc_lex_gettoken(lexer, isc_o, isc_t); \
if (isc_r != ISC_R_SUCCESS) { \
switch (isc_r) { \ switch (isc_r) { \
case ISC_R_NOMEMORY: \ case DNS_R_SUCCESS: \
result = DNS_R_NOMEMORY; \
break; \ break; \
default: \ case DNS_R_UNEXPECTED: \
UNEXPECTED_ERROR(__FILE__, __LINE__, \
"isc_lex_gettoken() failed: %s\n", \
isc_result_totext(isc_r)); \
result = DNS_R_UNEXPECTED; \
goto cleanup; \ goto cleanup; \
} \ default: \
goto error_cleanup; \ goto error_cleanup; \
} \ } \
if (eol != ISC_TRUE) \ } while (0) \
if (isc_t->type == isc_tokentype_eol || \
isc_t->type == isc_tokentype_eof) { \ static inline dns_result_t
(*callbacks->error)(callbacks, \ gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token,
"dns_load_master: %s:%d unexpected end of %s\n", \ isc_boolean_t eol, char *master_file, dns_rdatacallbacks_t *callbacks)
master_file, \ {
isc_lex_getsourceline(lex), \ isc_result_t result;
(isc_t->type == isc_tokentype_eol) ? \
"line" : "file"); \ options |= ISC_LEXOPT_EOL | ISC_LEXOPT_EOF | ISC_LEXOPT_DNSMULTILINE;
result = DNS_R_UNEXPECTEDEND; \ result = isc_lex_gettoken(lex, options, token);
goto cleanup; \ if (result != ISC_R_SUCCESS) {
} \ switch (result) {
} while (0) case ISC_R_NOMEMORY:
return (DNS_R_NOMEMORY);
default:
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_lex_gettoken() failed: %s\n",
isc_result_totext(result));
return (DNS_R_UNEXPECTED);
}
/*NOTREACHED*/
}
if (eol != ISC_TRUE)
if (token->type == isc_tokentype_eol ||
token->type == isc_tokentype_eof) {
(*callbacks->error)(callbacks,
"dns_load_master: %s:%d unexpected end of %s\n",
master_file,
isc_lex_getsourceline(lex),
(token->type == isc_tokentype_eol) ?
"line" : "file");
return (DNS_R_UNEXPECTEDEND);
}
return (DNS_R_SUCCESS);
}
dns_result_t dns_result_t
dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin, dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
@@ -173,8 +186,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
isc_lexspecials_t specials; isc_lexspecials_t specials;
REQUIRE(master_file != NULL); REQUIRE(master_file != NULL);
REQUIRE(top != NULL); REQUIRE(dns_name_isabsolute(top));
REQUIRE(origin != NULL); REQUIRE(dns_name_isabsolute(origin));
REQUIRE(callbacks != NULL); REQUIRE(callbacks != NULL);
REQUIRE(callbacks->commit != NULL); REQUIRE(callbacks->commit != NULL);
REQUIRE(callbacks->error != NULL); REQUIRE(callbacks->error != NULL);
@@ -391,7 +404,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
* If we are processing glue and the new name does * If we are processing glue and the new name does
* not match the current glue name, commit the glue * not match the current glue name, commit the glue
* and pop stacks leaving us in 'normal' processing * and pop stacks leaving us in 'normal' processing
* state. * state. Linked lists are undone by commit().
*/ */
if (in_glue && dns_name_compare(&glue_name, if (in_glue && dns_name_compare(&glue_name,
&new_name) != 0) { &new_name) != 0) {