]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - conf/cf-lex.l
Configuration strings are constant.
[thirdparty/bird.git] / conf / cf-lex.l
index 83e4e77c45a7b13e30d1c3e4a7aaac41151e74b1..1d6cae2cd52212a5e89e561c5cfd4da984d13323 100644 (file)
@@ -88,7 +88,7 @@ HASH_DEFINE_REHASH_FN(SYM, struct symbol)
 HASH(struct keyword) kw_hash;
 
 
-static struct sym_scope *conf_this_scope;
+struct sym_scope *conf_this_scope;
 
 linpool *cfg_mem;
 
@@ -168,7 +168,7 @@ WHITE [ \t]
   char *e;
 
   errno = 0;
-  l = bstrtoul(yytext, &e, 10);
+  l = bstrtoul10(yytext, &e);
   if (e && (*e != ':') || (errno == ERANGE) || (l >> 32))
     cf_error("ASN out of range");
 
@@ -186,7 +186,7 @@ WHITE [ \t]
   }
 
   errno = 0;
-  l = bstrtoul(e+1, &e, 10);
+  l = bstrtoul10(e+1, &e);
   if (e && *e || (errno == ERANGE) || (l >> len2))
     cf_error("Number out of range");
   cf_lval.i64 |= l;
@@ -213,13 +213,13 @@ WHITE [ \t]
   }
 
   errno = 0;
-  l = bstrtoul(yytext+2, &e, 10);
+  l = bstrtoul10(yytext+2, &e);
   if (e && (*e != ':') || (errno == ERANGE) || (l >> len1))
     cf_error("ASN out of range");
   cf_lval.i64 |= ((u64) l) << len2;
 
   errno = 0;
-  l = bstrtoul(e+1, &e, 10);
+  l = bstrtoul10(e+1, &e);
   if (e && *e || (errno == ERANGE) || (l >> len2))
     cf_error("Number out of range");
   cf_lval.i64 |= l;
@@ -241,7 +241,7 @@ WHITE [ \t]
   cf_lval.i64 |= ((u64) ip4_to_u32(ip4)) << 16;
 
   errno = 0;
-  l = bstrtoul(e, &e, 10);
+  l = bstrtoul10(e, &e);
   if (e && *e || (errno == ERANGE) || (l >> 16))
     cf_error("Number out of range");
   cf_lval.i64 |= l;
@@ -265,7 +265,7 @@ WHITE [ \t]
   char *e;
   unsigned long int l;
   errno = 0;
-  l = bstrtoul(yytext+2, &e, 16);
+  l = bstrtoul16(yytext+2, &e);
   if (e && *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l)
     cf_error("Number out of range");
   cf_lval.i = l;
@@ -276,7 +276,7 @@ WHITE [ \t]
   char *e;
   unsigned long int l;
   errno = 0;
-  l = bstrtoul(yytext, &e, 10);
+  l = bstrtoul10(yytext, &e);
   if (e && *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l)
     cf_error("Number out of range");
   cf_lval.i = l;
@@ -719,7 +719,8 @@ cf_lex_init(int is_cli, struct config *c)
   else
     BEGIN(INITIAL);
 
-  conf_this_scope = cfg_allocz(sizeof(struct sym_scope));
+  c->root_scope = cfg_allocz(sizeof(struct sym_scope));
+  conf_this_scope = c->root_scope;
   conf_this_scope->active = 1;
 }
 
@@ -742,6 +743,7 @@ cf_push_scope(struct symbol *sym)
   conf_this_scope = s;
   s->active = 1;
   s->name = sym;
+  s->slots = 0;
 }
 
 /**
@@ -756,6 +758,7 @@ cf_pop_scope(void)
 {
   conf_this_scope->active = 0;
   conf_this_scope = conf_this_scope->next;
+
   ASSERT(conf_this_scope);
 }