From f6b8f48d1665c4487dedbcfa4dca435a0d67ddeb Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Wed, 19 Jan 2022 20:14:16 +0100 Subject: [#189] Whitespace fixes in opened files --- keama/conflex.c | 67 ++++++++++++++++++++++++------------------------ keama/confparse.c | 56 ++++++++++++++++++++-------------------- keama/data.c | 10 ++++---- keama/eval.c | 16 ++++++------ keama/keama.c | 8 +++--- keama/keama.h | 2 +- keama/options.c | 2 +- keama/parse.c | 76 +++++++++++++++++++++++++++---------------------------- keama/print.c | 8 +++--- keama/reduce.c | 4 +-- 10 files changed, 124 insertions(+), 125 deletions(-) (limited to 'keama') diff --git a/keama/conflex.c b/keama/conflex.c index 09f147f8..9a635732 100644 --- a/keama/conflex.c +++ b/keama/conflex.c @@ -186,7 +186,7 @@ get_char(struct parse *cfile) if (!cfile->ugflag) { if (c == EOL) { - if (cfile->cur_line == cfile->line1) { + if (cfile->cur_line == cfile->line1) { cfile->cur_line = cfile->line2; cfile->prev_line = cfile->line1; } else { @@ -224,11 +224,11 @@ unget_char(struct parse *cfile, int c) { /* * GENERAL NOTE ABOUT TOKENS * - * We normally only want non-whitespace tokens. There are some + * We normally only want non-whitespace tokens. There are some * circumstances where we *do* want to see whitespace (for example * when parsing IPv6 addresses). * - * Generally we use the next_token() function to read tokens. This + * Generally we use the next_token() function to read tokens. This * in turn calls get_next_token, which does *not* return tokens for * whitespace. Rather, it skips these. * @@ -254,7 +254,7 @@ get_raw_token(struct parse *cfile) { p = cfile->lpos; c = get_char(cfile); - if (!((c == '\n') && cfile->eol_token) && + if (!((c == '\n') && cfile->eol_token) && isascii(c) && isspace(c)) { ttok = read_whitespace(c, cfile); break; @@ -301,12 +301,12 @@ get_raw_token(struct parse *cfile) { * The get_next_token() function consumes the next token and * returns it to the caller. * - * Since the code is almost the same for "normal" and "raw" + * Since the code is almost the same for "normal" and "raw" * input, we pass a flag to alter the way it works. */ -static enum dhcp_token -get_next_token(const char **rval, unsigned *rlen, +static enum dhcp_token +get_next_token(const char **rval, unsigned *rlen, struct parse *cfile, isc_boolean_t raw) { int rv; @@ -328,7 +328,7 @@ get_next_token(const char **rval, unsigned *rlen, cfile->token_line = cfile->cur_line; } } - + if (rval) *rval = cfile->tval; if (rlen) @@ -339,10 +339,10 @@ get_next_token(const char **rval, unsigned *rlen, /* * Get the next token from cfile and return it. * - * If rval is non-NULL, set the pointer it contains to + * If rval is non-NULL, set the pointer it contains to * the contents of the token. * - * If rlen is non-NULL, set the integer it contains to + * If rlen is non-NULL, set the integer it contains to * the length of the token. */ @@ -367,8 +367,8 @@ next_raw_token(const char **rval, unsigned *rlen, struct parse *cfile) { * The do_peek_token() function checks the next token without * consuming it, and returns it to the caller. * - * Since the code is almost the same for "normal" and "raw" - * input, we pass a flag to alter the way it works. (See the + * Since the code is almost the same for "normal" and "raw" + * input, we pass a flag to alter the way it works. (See the * warning in the GENERAL NOTES ABOUT TOKENS above though.) */ @@ -405,15 +405,15 @@ do_peek_token(const char **rval, unsigned int *rlen, /* - * Get the next token from cfile and return it, leaving it for a + * Get the next token from cfile and return it, leaving it for a * subsequent call to next_token(). * * Note that it WILL consume whitespace tokens. * - * If rval is non-NULL, set the pointer it contains to + * If rval is non-NULL, set the pointer it contains to * the contents of the token. * - * If rlen is non-NULL, set the integer it contains to + * If rlen is non-NULL, set the integer it contains to * the length of the token. */ @@ -484,7 +484,7 @@ read_whitespace(int c, struct parse *cfile) { c = get_char(cfile); if (c == EOF) return END_OF_FILE; - } while (!((c == '\n') && cfile->eol_token) && + } while (!((c == '\n') && cfile->eol_token) && isascii(c) && isspace(c)); /* @@ -648,7 +648,7 @@ read_number(int c, struct parse *cfile) goto end_read; default: - parse_error(cfile, + parse_error(cfile, "read_number(): impossible case"); } @@ -936,7 +936,7 @@ intern(char *atom, enum dhcp_token dfv) { } break; case 'e': - if (isascii(atom [1]) && + if (isascii(atom [1]) && tolower((unsigned char)atom[1]) == 'x') { if (!strcasecmp(atom + 2, "tract-int")) return EXTRACT_INT; @@ -1035,15 +1035,15 @@ intern(char *atom, enum dhcp_token dfv) { } break; case 'i': - if (!strcasecmp(atom+1, "a-na")) + if (!strcasecmp(atom+1, "a-na")) return IA_NA; - if (!strcasecmp(atom+1, "a-ta")) + if (!strcasecmp(atom+1, "a-ta")) return IA_TA; - if (!strcasecmp(atom+1, "a-pd")) + if (!strcasecmp(atom+1, "a-pd")) return IA_PD; - if (!strcasecmp(atom+1, "aaddr")) + if (!strcasecmp(atom+1, "aaddr")) return IAADDR; - if (!strcasecmp(atom+1, "aprefix")) + if (!strcasecmp(atom+1, "aprefix")) return IAPREFIX; if (!strcasecmp(atom + 1, "nclude")) return INCLUDE; @@ -1332,11 +1332,11 @@ intern(char *atom, enum dhcp_token dfv) { case 's': if (!strcasecmp(atom + 1, "cript")) return SCRIPT; - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'e') { if (!strcasecmp(atom + 2, "arch")) return SEARCH; - if (isascii(atom[2]) && + if (isascii(atom[2]) && tolower((unsigned char)atom[2]) == 'c') { if (!strncasecmp(atom + 3, "ond", 3)) { if (!strcasecmp(atom + 6, "ary")) @@ -1366,7 +1366,7 @@ intern(char *atom, enum dhcp_token dfv) { return TOKEN_SERVER; if (atom[6] == '-') { if (!strcasecmp(atom + 7, - "duid")) + "duid")) return SERVER_DUID; if (!strcasecmp(atom + 7, "name")) @@ -1386,7 +1386,7 @@ intern(char *atom, enum dhcp_token dfv) { return TOKEN_SET; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'h') { if (!strcasecmp(atom + 2, "ared-network")) return SHARED_NETWORK; @@ -1394,7 +1394,7 @@ intern(char *atom, enum dhcp_token dfv) { return SHUTDOWN; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'i') { if (!strcasecmp(atom + 2, "addr")) return SIADDR; @@ -1404,9 +1404,9 @@ intern(char *atom, enum dhcp_token dfv) { return SIZE; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'p') { - if (isascii(atom[2]) && + if (isascii(atom[2]) && tolower((unsigned char)atom[2]) == 'a') { if (!strcasecmp(atom + 3, "ce")) return SPACE; @@ -1418,9 +1418,9 @@ intern(char *atom, enum dhcp_token dfv) { return SPLIT; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 't') { - if (isascii(atom[2]) && + if (isascii(atom[2]) && tolower((unsigned char)atom[2]) == 'a') { if (!strncasecmp(atom + 3, "rt", 2)) { if (!strcasecmp(atom + 5, "s")) @@ -1453,7 +1453,7 @@ intern(char *atom, enum dhcp_token dfv) { return SUBSTRING; break; } - if (isascii(atom[1]) && + if (isascii(atom[1]) && tolower((unsigned char)atom[1]) == 'u') { if (!strcasecmp(atom + 2, "ffix")) return SUFFIX; @@ -1547,4 +1547,3 @@ intern(char *atom, enum dhcp_token dfv) { } return dfv; } - diff --git a/keama/confparse.c b/keama/confparse.c index 95d4ebea..d77503af 100644 --- a/keama/confparse.c +++ b/keama/confparse.c @@ -607,7 +607,7 @@ parse_statement(struct parse *cfile, int type, isc_boolean_t declaration) read_conf_file(cfile, val, type); parse_semi(cfile); return 1; - + case HOST: skip_token(&val, NULL, cfile); if (type != HOST_DECL && type != CLASS_DECL) @@ -924,7 +924,7 @@ parse_statement(struct parse *cfile, int type, isc_boolean_t declaration) failover_once = ISC_FALSE; skip_to_semi(cfile); break; - + case SERVER_DUID: if (local_family != AF_INET6) goto unknown; @@ -966,7 +966,7 @@ parse_statement(struct parse *cfile, int type, isc_boolean_t declaration) } if (mapSize(et) == 0) return declaration; - + et->skip = ISC_TRUE; cfile->issue_counter++; mapSet(cfile->stack[cfile->stack_top], et, "statement"); @@ -976,12 +976,12 @@ parse_statement(struct parse *cfile, int type, isc_boolean_t declaration) } /*! - * + * * \brief Parse allow and deny statements * * This function handles the common processing code for permit and deny * statements in the parse_pool_statement and parse_pool6_statement functions. - * + * * The allow or deny token should already be consumed, this function expects * one of the following: * known-clients; @@ -1019,7 +1019,7 @@ get_permit(struct parse *cfile, struct element *permit_head) negative = ISC_TRUE; alias = makeString(-1, "unknown clients"); break; - + case KNOWN_CLIENTS: need_clients = ISC_FALSE; permit = CLASS_KNOWN; @@ -1037,7 +1037,7 @@ get_permit(struct parse *cfile, struct element *permit_head) permit = CLASS_KNOWN; alias = makeString(-1, "known clients"); break; - + case AUTHENTICATED: permit = CLASS_ALL; alias = makeString(-1, "authenticated clients"); @@ -1046,7 +1046,7 @@ get_permit(struct parse *cfile, struct element *permit_head) comment = createComment("/// [un]authenticated-clients is " "not supported by ISC DHCP and Kea"); break; - + case UNAUTHENTICATED: permit = CLASS_ALL; alias = makeString(-1, "unauthenticated clients"); @@ -1057,7 +1057,7 @@ get_permit(struct parse *cfile, struct element *permit_head) permit = CLASS_ALL; alias = makeString(-1, "all clients"); break; - + case DYNAMIC: /* bootp is not supported by Kea so the dynamic bootp * client set is the empty set. */ @@ -1192,7 +1192,7 @@ parse_pool_statement(struct parse *cfile, int type) skip_token(&val, NULL, cfile); get_permit(cfile, prohibit); break; - + case RBRACE: skip_token(&val, NULL, cfile); done = ISC_TRUE; @@ -1412,7 +1412,7 @@ parse_host_declaration(struct parse *cfile) host_id = makeString(-1, val); appendString(host_id, " "); if (token == V6RELOPT) { - token = next_token(&val, NULL, cfile); + token = next_token(&val, NULL, cfile); if (token != NUMBER) parse_error(cfile, @@ -1428,7 +1428,7 @@ parse_host_declaration(struct parse *cfile) if (relays > MAX_V6RELAY_HOPS) relays = MAX_V6RELAY_HOPS + 1; } else if (token != OPTION) - parse_error(cfile, + parse_error(cfile, "host-identifier must be an option" " or v6relopt"); known = ISC_FALSE; @@ -1571,7 +1571,7 @@ static void add_host_reservation_identifiers(struct parse *, const char *); * in fact: * (CLASS) NAME(STRING) LBRACE ... RBRACE * (SUBCLASS) SUPER(STRING) DATA/HASH(STRING | ) [BRACE ... RBRACE] - * + * * class "name" { MATCH IF }: direct: belong when true * class "name" { MATCH }: indirect: use subclasses * class "name" { MATCH SPAWN WITH }: indirect: @@ -1600,7 +1600,7 @@ parse_class_declaration(struct parse *cfile, int type) isc_boolean_t lose = ISC_FALSE; isc_boolean_t matchedonce = ISC_FALSE; isc_boolean_t submatchedonce = ISC_FALSE; - + token = next_token(&val, NULL, cfile); if (token != STRING) parse_error(cfile, "Expecting class name"); @@ -1708,7 +1708,7 @@ parse_class_declaration(struct parse *cfile, int type) } } } - + /* Note the class declaration in the enclosing group */ if (group_classes != classes) { struct element *gc; @@ -2536,12 +2536,12 @@ parse_group_declaration(struct parse *cfile) token = peek_token(&val, NULL, cfile); if (is_identifier(token) || token == STRING) { skip_token(&val, NULL, cfile); - + name = makeString(-1, val); if (!name) parse_error(cfile, "no memory for group decl name %s", val); - } + } parse_lbrace(cfile); @@ -3208,7 +3208,7 @@ parse_address_range(struct parse *cfile, int type, size_t where) | ip-address6 SLASH number SEMI | ip-address6 [SLASH number] TEMPORARY SEMI */ -void +void parse_address_range6(struct parse *cfile, int type, size_t where) { struct string *low, *high, *range; @@ -3234,7 +3234,7 @@ parse_address_range6(struct parse *cfile, int type, size_t where) range = allocString(); concatString(range, low); - /* + /* * See if we we're using range or CIDR notation or TEMPORARY */ token = peek_token(&val, NULL, cfile); @@ -3260,7 +3260,7 @@ parse_address_range6(struct parse *cfile, int type, size_t where) appendString(range, " "); appendString(range, val); skip_token(NULL, NULL, cfile); - } + } } else if (token == TEMPORARY) { /* * temporary (RFC 4941) @@ -3271,7 +3271,7 @@ parse_address_range6(struct parse *cfile, int type, size_t where) skip_token(NULL, NULL, cfile); } else { /* - * No '/', so we are looking for the end address of + * No '/', so we are looking for the end address of * the IPv6 pool. */ high = parse_ip6_addr_txt(cfile); @@ -3329,7 +3329,7 @@ parse_address_range6(struct parse *cfile, int type, size_t where) /* prefix6-declaration :== ip-address6 ip-address6 SLASH number SEMI */ -void +void parse_prefix6(struct parse *cfile, int type, size_t where) { struct string *lo, *hi; @@ -3528,7 +3528,7 @@ parse_pool6_statement(struct parse *cfile, int type) skip_token(NULL, NULL, cfile); get_permit(cfile, prohibit); break; - + case RBRACE: skip_token(&val, NULL, cfile); done = ISC_TRUE; @@ -3786,7 +3786,7 @@ parse_allow_deny(struct parse *cfile, int flag) * server-duid ll ethernet|ieee802|fddi 00:16:6F:49:7D:9B; * server-duid en 2495 "enterprise-specific-identifier-1234"; */ -void +void parse_server_duid_conf(struct parse *cfile) { enum dhcp_token token; const char *val; @@ -3809,7 +3809,7 @@ parse_server_duid_conf(struct parse *cfile) { */ token = next_token(&val, NULL, cfile); - /* + /* * Enterprise is the easiest - enterprise number and raw data * are required. */ @@ -3837,7 +3837,7 @@ parse_server_duid_conf(struct parse *cfile) { mapSet(duid, item, "identifier"); } - /* + /* * Next easiest is the link-layer DUID. It consists only of * the LL directive, or optionally the specific value to use. * @@ -3878,7 +3878,7 @@ parse_server_duid_conf(struct parse *cfile) { } } - /* + /* * Finally the link-layer DUID plus time. It consists only of * the LLT directive, or optionally the specific value to use. * @@ -3932,7 +3932,7 @@ parse_server_duid_conf(struct parse *cfile) { * * In this case, they have to put in the complete value. * - * This also works for existing DUID types of course. + * This also works for existing DUID types of course. */ else if (token == NUMBER) { item = createString(makeString(-1, val)); diff --git a/keama/data.c b/keama/data.c index 3aef5507..d63c2cb9 100644 --- a/keama/data.c +++ b/keama/data.c @@ -199,7 +199,7 @@ makeStringExt(int l, const char *s, char fmt) case 'I': { /* IPv4 address to text */ - char buf[40 /* INET_ADDRSTRLEN == 26 */]; + char buf[40 /* INET_ADDRSTRLEN == 26 */]; assert(l > 3); assert(inet_ntop(AF_INET, s, buf, sizeof(buf)) != NULL); @@ -263,7 +263,7 @@ makeStringExt(int l, const char *s, char fmt) assert(0); } } - + struct string * makeStringArray(int l, const char *s, char fmt) { @@ -542,7 +542,7 @@ resetInt(struct element *e, int64_t i) e->type = ELEMENT_INTEGER; e->value.int_value = i; } - + void resetDouble(struct element *e, double d) { @@ -677,7 +677,7 @@ listSet(struct element *l, struct element *e, int i) TAILQ_INSERT_HEAD(&l->value.list_value, e); } else { struct element *prev; - + prev = TAILQ_FIRST(&l->value.list_value); assert(prev != NULL); assert(prev->key == NULL); @@ -964,7 +964,7 @@ addIndent(FILE *fp, int skip, unsigned indent) } else for (sp = 0; sp < indent; ++sp) fprintf(fp, " "); -} +} void printList(FILE *fp, const struct list *l, isc_boolean_t skip, unsigned indent) diff --git a/keama/eval.c b/keama/eval.c index bd738933..91ba4fd0 100644 --- a/keama/eval.c +++ b/keama/eval.c @@ -456,7 +456,7 @@ eval_boolean_expression(struct element *expr, isc_boolean_t *modifiedp) * data_expression :== SUBSTRING LPAREN data-expression COMMA * numeric-expression COMMA * numeric-expression RPAREN | - * CONCAT LPAREN data-expression COMMA + * CONCAT LPAREN data-expression COMMA * data-expression RPAREN * SUFFIX LPAREN data_expression COMMA * numeric-expression RPAREN | @@ -1155,7 +1155,7 @@ eval_data_expression(struct element *expr, isc_boolean_t *modifiedp) fmt = "%x"; break; } - + for (i = 0; i < buf->length; i++) { uint8_t val; char num[4]; @@ -1172,7 +1172,7 @@ eval_data_expression(struct element *expr, isc_boolean_t *modifiedp) if ((buf->length % 2) != 0) return expr; - + switch (b) { case 8: fmt = "%o"; @@ -1185,11 +1185,11 @@ eval_data_expression(struct element *expr, isc_boolean_t *modifiedp) fmt = "%x"; break; } - + for (i = 0; i < buf->length; i += 2) { uint16_t val; char num[8]; - + if (i != 0) concatString(r, sep); memcpy(&val, buf->content + i, 2); @@ -1203,7 +1203,7 @@ eval_data_expression(struct element *expr, isc_boolean_t *modifiedp) if ((buf->length % 4) != 0) return expr; - + switch (b) { case 8: fmt = "%llo"; @@ -1216,11 +1216,11 @@ eval_data_expression(struct element *expr, isc_boolean_t *modifiedp) fmt = "%llx"; break; } - + for (i = 0; i < buf->length; i += 4) { uint32_t val; char num[40]; - + if (i != 0) concatString(r, sep); memcpy(&val, buf->content + i, 4); diff --git a/keama/keama.c b/keama/keama.c index 1df3c551..401ddf2c 100644 --- a/keama/keama.c +++ b/keama/keama.c @@ -63,7 +63,7 @@ isc_boolean_t json = ISC_FALSE; static const char use_noarg[] = "No argument for command: %s"; static const char bad_resolve[] = "Bad -r argument: %s"; -int +int main(int argc, char **argv) { int i, fd; char *inbuf = NULL; @@ -107,7 +107,7 @@ main(int argc, char **argv) { if (++i == argc) usage(use_noarg, argv[i - 1]); output_file = argv[i]; - } else + } else usage("Unknown command: %s", argv[i]); } @@ -201,10 +201,10 @@ parse_error(struct parse *cfile, const char *fmt, ...) char mbuf[1024]; char fbuf[1024]; unsigned i, lix; - + snprintf(fbuf, sizeof(fbuf), "%s line %d: %s", cfile->tlname, cfile->lexline, fmt); - + va_start(list, fmt); vsnprintf(mbuf, sizeof(mbuf), fbuf, list); va_end(list); diff --git a/keama/keama.h b/keama/keama.h index 54f887fe..4b971396 100644 --- a/keama/keama.h +++ b/keama/keama.h @@ -31,7 +31,7 @@ #include /* Resolution of FQDNs into IPv4 addresses */ -enum resolve { +enum resolve { perform = 0, /* resolve */ fatal, /* raise a fatal error */ pass /* pass the string wth a warning */ diff --git a/keama/options.c b/keama/options.c index ec8c47ce..e615ece4 100644 --- a/keama/options.c +++ b/keama/options.c @@ -1061,7 +1061,7 @@ get_config_comments(unsigned code) log_threshold: comment = createComment("/// Reference Kea #222"); TAILQ_INSERT_TAIL(&comments, comment); - break; + break; case 84: /* log-threshold-high */ comment = createComment("/// log-threshold-high is not (yet?) " diff --git a/keama/parse.c b/keama/parse.c index 3297e80e..9d00d44c 100644 --- a/keama/parse.c +++ b/keama/parse.c @@ -88,7 +88,7 @@ skip_to_semi(struct parse *cfile) statement foo bar { } statement foo bar { statement { } } statement} - + ...et cetera. */ void skip_to_rbrace(struct parse *cfile, int brace_count) @@ -176,7 +176,7 @@ parse_host_name(struct parse *cfile) const char *val; enum dhcp_token token; struct string *s = NULL; - + /* Read a dotted hostname... */ do { /* Read a token, which should be an identifier. */ @@ -204,7 +204,7 @@ parse_host_name(struct parse *cfile) /* ip-addr-or-hostname :== ip-address | hostname ip-address :== NUMBER DOT NUMBER DOT NUMBER DOT NUMBER - + Parse an ip address or a hostname. Note that RFC1123 permits hostnames to consist of all digits, @@ -282,7 +282,7 @@ parse_ip_addr_or_hostname(struct parse *cfile, isc_boolean_t check_multi) return makeStringExt(bin->length, bin->content, 'I'); } - + /* * ip-address :== NUMBER DOT NUMBER DOT NUMBER DOT NUMBER */ @@ -294,7 +294,7 @@ parse_ip_addr(struct parse *cfile) unsigned len = sizeof(addr); return parse_numeric_aggregate(cfile, addr, &len, DOT, 10, 8); -} +} /* * Return true if every character in the string is hexadecimal. @@ -316,7 +316,7 @@ is_hex_string(const char *s) * * See section 2.2 of RFC 1884 for details. * - * We are lazy for this. We pull numbers, names, colons, and dots + * We are lazy for this. We pull numbers, names, colons, and dots * together and then throw the resulting string at the inet_pton() * function. */ @@ -332,7 +332,7 @@ parse_ip6_addr(struct parse *cfile) int v6_len; /* - * First token is non-raw. This way we eat any whitespace before + * First token is non-raw. This way we eat any whitespace before * our IPv6 address begins, like one would expect. */ token = peek_token(&val, NULL, cfile); @@ -655,7 +655,7 @@ parse_option_name(struct parse *cfile, if (!is_identifier(token)) parse_error(cfile, "expecting identifier after option keyword."); - + uname = strdup(val); if (!uname) parse_error(cfile, "no memory for uname information."); @@ -792,7 +792,7 @@ parse_option_space_decl(struct parse *cfile) universe->old = strdup(val); universe->name = universe->old; push_space(universe); - + do { token = next_token(&val, NULL, cfile); switch(token) { @@ -951,7 +951,7 @@ parse_option_code_definition(struct parse *cfile, struct option *option) struct string *saved; struct string *format; struct element *optdef; - + if (option->space->status == special) { parse_vendor_code_definition(cfile, option); return; @@ -1451,7 +1451,7 @@ parse_base64(struct parse *cfile) struct string *t; struct string *r; isc_boolean_t valid_base64; - + r = allocString(); /* It's possible for a + or a / to cause a base64 quantity to be @@ -1582,7 +1582,7 @@ parse_executable_statements(struct element *statements, } if (!*lose) return ISC_TRUE; - + return ISC_FALSE; } @@ -1731,7 +1731,7 @@ parse_executable_statement(struct element *result, case ON: skip_token(&val, NULL, cfile); return parse_on_statement(result, cfile, lose); - + case SWITCH: skip_token(&val, NULL, cfile); return parse_switch_statement(result, cfile, lose); @@ -1755,7 +1755,7 @@ parse_executable_statement(struct element *result, cfile->issue_counter++; mapSet(result, st, "default"); return ISC_TRUE; - + case DEFINE: case TOKEN_SET: skip_token(&val, NULL, cfile); @@ -2028,7 +2028,7 @@ parse_executable_statement(struct element *result, if (!parse_zone(zone, cfile)) goto badzone; return ISC_TRUE; - + /* Also not really a statement, but same idea as above. */ case KEY: skip_token(&val, NULL, cfile); @@ -2116,7 +2116,7 @@ parse_zone(struct element *zone, struct parse *cfile) values = createList(); mapSet(zone, values, "primary"); goto consemup; - + case SECONDARY: if (mapContains(zone, "secondary")) parse_error(cfile, "more than one secondary."); @@ -2183,7 +2183,7 @@ parse_zone(struct element *zone, struct parse *cfile) mapSet(zone, createString(key_name), "key"); parse_semi(cfile); break; - + default: done = 1; break; @@ -2256,7 +2256,7 @@ parse_key(struct element* result, struct parse *cfile) if (!s) appendString(alg, ".SIG-ALG.REG.INT."); /* If there is no trailing '.', hack one in. */ - else + else appendString(alg, "."); mapSet(key, createString(alg), "algorithm"); break; @@ -2329,7 +2329,7 @@ parse_on_statement(struct element *result, case COMMIT: case RELEASE: case TRANSMISSION: - appendString(cond, val); + appendString(cond, val); break; default: @@ -2339,7 +2339,7 @@ parse_on_statement(struct element *result, if (token == OR) appendString(cond, " or "); } while (token == OR); - + mapSet(statement, createString(cond), "condition"); /* Semicolon means no statements. */ @@ -2567,7 +2567,7 @@ parse_if_statement(struct element *result, } mapSet(statement, branch, "else"); } - + return ISC_TRUE; } @@ -2581,7 +2581,7 @@ parse_if_statement(struct element *result, * boolean-expression OR boolean-expression * EXISTS OPTION-NAME */ - + isc_boolean_t parse_boolean_expression(struct element *expr, struct parse *cfile, @@ -2625,7 +2625,7 @@ parse_boolean(struct parse *cfile) * data_expression :== SUBSTRING LPAREN data-expression COMMA * numeric-expression COMMA * numeric-expression RPAREN | - * CONCAT LPAREN data-expression COMMA + * CONCAT LPAREN data-expression COMMA * data-expression RPAREN * SUFFIX LPAREN data_expression COMMA * numeric-expression RPAREN | @@ -3181,14 +3181,14 @@ parse_non_binary(struct element *expr, if (token != RPAREN) goto norparen; break; - + case STRING: skip_token(&val, &len, cfile); resetString(expr, makeString(len, val)); break; case EXTRACT_INT: - skip_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); nexp = createMap(); nexp->skip = ISC_TRUE; cfile->issue_counter++; @@ -3232,9 +3232,9 @@ parse_non_binary(struct element *expr, if (token != RPAREN) parse_error(cfile, "right parenthesis expected."); break; - + case ENCODE_INT: - skip_token(&val, NULL, cfile); + skip_token(&val, NULL, cfile); nexp = createMap(); nexp->skip = ISC_TRUE; cfile->issue_counter++; @@ -3274,7 +3274,7 @@ parse_non_binary(struct element *expr, if (token != RPAREN) parse_error(cfile, "right parenthesis expected."); break; - + case NUMBER: /* If we're in a numeric context, this should just be a number, by itself. */ @@ -3535,7 +3535,7 @@ parse_non_binary(struct element *expr, nexp->skip = ISC_TRUE; cfile->issue_counter++; mapSet(expr, nexp, "v6relay"); - + token = next_token(&val, NULL, cfile); if (token != LPAREN) goto nolparen; @@ -3736,7 +3736,7 @@ new_rhs: resetBy(expr, rhs); return ISC_TRUE; } - + lhs = rhs; rhs = NULL; binop = next_op; @@ -3775,7 +3775,7 @@ new_rhs: rhs_context = expression_context(rhs); lhs_context = expression_context(lhs); - if ((rhs_context != context_any) && + if ((rhs_context != context_any) && (lhs_context != context_any) && (rhs_context != lhs_context)) parse_error(cfile, "illegal expression relating " @@ -3876,20 +3876,20 @@ new_rhs: /* Now combine the LHS and the RHS using binop. */ tmp = createMap(); tmp->skip = ISC_TRUE; - + /* Store the LHS and RHS. */ mapSet(tmp, lhs, "left"); mapSet(tmp, rhs, "right"); lhs = createMap(); mapSet(lhs, tmp, binop_name); - + tmp = NULL; rhs = NULL; binop = next_op; goto new_rhs; -} +} /* Escape embedded commas, detected heading and leading space */ struct string * @@ -4296,7 +4296,7 @@ parse_option_statement(struct element *result, if ((token == SEMI) && (option->format[0] != 'Z')) { /* Eat the semicolon... */ /* - * XXXSK: I'm not sure why we should ever get here, but we + * XXXSK: I'm not sure why we should ever get here, but we * do during our startup. This confuses things if * we are parsing a zero-length option, so don't * eat the semicolon token in that case. @@ -4335,7 +4335,7 @@ parse_option_statement(struct element *result, r = makeStringExt(s->length, s->content, 'X'); data = createString(r); - mapSet(opt_data, data, "data"); + mapSet(opt_data, data, "data"); } else if ((expr->type == ELEMENT_MAP) && mapContains(expr, "const-data")) { struct element *value; @@ -4819,7 +4819,7 @@ parse_config_data(struct element *expr, parse_error(cfile, "Bad format '%c' in parse_config_data.", option->format[0]); } - + mapSet(expr, elem, "value"); return ISC_TRUE; @@ -4888,7 +4888,7 @@ parse_config_statement(struct element *result, if ((token == SEMI) && (option->format[0] != 'Z')) { /* Eat the semicolon... */ /* - * XXXSK: I'm not sure why we should ever get here, but we + * XXXSK: I'm not sure why we should ever get here, but we * do during our startup. This confuses things if * we are parsing a zero-length option, so don't * eat the semicolon token in that case. diff --git a/keama/print.c b/keama/print.c index 41fbd293..8cfd0097 100644 --- a/keama/print.c +++ b/keama/print.c @@ -44,7 +44,7 @@ print_expression(struct element *expr, isc_boolean_t *lose) return print_numeric_expression(expr, lose); if (expr->type == ELEMENT_STRING) return print_data_expression(expr, lose); - + if (is_boolean_expression(expr)) return print_boolean_expression(expr, lose); if (is_numeric_expression(expr)) @@ -821,7 +821,7 @@ print_data_expression(struct element *expr, isc_boolean_t *lose) struct element *width; struct element *separator; struct element *buffer; - + appendString(result, "binary-to-ascii("); arg = mapGet(expr, "binary-to-ascii"); if ((arg == NULL) || (arg->type != ELEMENT_MAP)) { @@ -877,7 +877,7 @@ print_data_expression(struct element *expr, isc_boolean_t *lose) struct element *arg; struct element *width; struct element *buffer; - + appendString(result, "reverse("); arg = mapGet(expr, "reverse"); if ((arg == NULL) || (arg->type != ELEMENT_MAP)) { @@ -986,7 +986,7 @@ print_data_expression(struct element *expr, isc_boolean_t *lose) struct element *arg; struct element *relay; struct element *option; - + appendString(result, "v6relay("); arg = mapGet(expr, "v6relay"); diff --git a/keama/reduce.c b/keama/reduce.c index e85a1a23..9c796458 100644 --- a/keama/reduce.c +++ b/keama/reduce.c @@ -355,7 +355,7 @@ reduce_boolean_expression(struct element *expr) * data_expression :== SUBSTRING LPAREN data-expression COMMA * numeric-expression COMMA * numeric-expression RPAREN | - * CONCAT LPAREN data-expression COMMA + * CONCAT LPAREN data-expression COMMA * data-expression RPAREN * SUFFIX LPAREN data_expression COMMA * numeric-expression RPAREN | @@ -504,7 +504,7 @@ reduce_data_expression(struct element *expr) concatString(result, stringValue(string)); snprintf(buf, sizeof(buf), ",-%u,all)", (unsigned)len); appendString(result, buf); - return createString(result); + return createString(result); } /* lowercase */ -- cgit v1.2.1