Replace -1 ret code
This commit is contained in:
parent
db0e1c074f
commit
b6bf81e3e9
1 changed files with 7 additions and 3 deletions
10
src/node.c
10
src/node.c
|
@ -540,7 +540,8 @@ edge * r3_node_find_common_prefix(node *n, char *path, int path_len, int *prefix
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (ret == -1) {
|
} else if (ret == -1) {
|
||||||
return -1;
|
|
||||||
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -568,8 +569,11 @@ node * r3_tree_insert_pathl_ex(node *tree, const char *path, int path_len, route
|
||||||
|
|
||||||
/* length of common prefix */
|
/* length of common prefix */
|
||||||
int prefix_len = 0;
|
int prefix_len = 0;
|
||||||
e = r3_node_find_common_prefix(tree, path, path_len, &prefix_len, errstr);
|
char *err = NULL;
|
||||||
if (e == -1) {
|
e = r3_node_find_common_prefix(tree, path, path_len, &prefix_len, &err);
|
||||||
|
if (err) {
|
||||||
|
// copy the error message pointer
|
||||||
|
if (errstr) *errstr = err;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue