|
@@ -204,6 +204,8 @@ static inline int route_new_list(struct route_list* rt)
|
|
LOG(L_CRIT, "ERROR: route_new_list: out of memory\n");
|
|
LOG(L_CRIT, "ERROR: route_new_list: out of memory\n");
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
|
|
+ /* init the newly allocated memory chunk */
|
|
|
|
+ memset(&tmp[rt->entries], 0, rt->entries*sizeof(struct action*));
|
|
rt->rlist=tmp;
|
|
rt->rlist=tmp;
|
|
rt->entries*=2;
|
|
rt->entries*=2;
|
|
}
|
|
}
|
|
@@ -248,6 +250,28 @@ error:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * if the "name" route already exists, return its index, else
|
|
|
|
+ * return error
|
|
|
|
+ * return route index in rt->rlist or -1 on error
|
|
|
|
+ */
|
|
|
|
+int route_lookup(struct route_list* rt, char* name)
|
|
|
|
+{
|
|
|
|
+ int len;
|
|
|
|
+ struct str_hash_entry* e;
|
|
|
|
+
|
|
|
|
+ len=strlen(name);
|
|
|
|
+ /* check if exists an non empty*/
|
|
|
|
+ e=str_hash_get(&rt->names, name, len);
|
|
|
|
+ if (e){
|
|
|
|
+ return e->u.n;
|
|
|
|
+ }else{
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
static int fix_actions(struct action* a); /*fwd declaration*/
|
|
static int fix_actions(struct action* a); /*fwd declaration*/
|
|
|
|
|
|
|
|
|