Add extra parenthesis around branched assignments

This commit is contained in:
Martijn Otto 2018-02-21 09:11:53 +01:00
parent 021c54308a
commit 5cab368af2
2 changed files with 5 additions and 5 deletions

View file

@ -144,7 +144,7 @@ int r3_tree_compile(R3Node *n, char **errstr)
int ret = 0;
// bool use_slug = r3_node_has_slug_edges(n);
if ( r3_node_has_slug_edges(n) ) {
if ( ret = r3_tree_compile_patterns(n, errstr) ) {
if (( ret = r3_tree_compile_patterns(n, errstr) )) {
return ret;
}
} else {
@ -422,7 +422,7 @@ R3Node * r3_tree_matchl(const R3Node * n, const char * path, unsigned int path_l
info("COMPARE COMPARE_STR\n");
if (e = r3_node_find_edge_str(n, path, path_len)) {
if ((e = r3_node_find_edge_str(n, path, path_len))) {
restlen = path_len - e->pattern.len;
if (!restlen) {
return e->child && e->child->endpoint ? e->child : NULL;

View file

@ -90,7 +90,7 @@ const char * r3_slug_find_placeholder(const char *s1, unsigned int str_len, unsi
const char *c;
const char *s2;
int cnt = 0;
if (c = strnchr(s1, str_len, '{')) {
if ((c = strnchr(s1, str_len, '{'))) {
// find closing '}'
s2 = c;
unsigned int j = str_len - (c - s1);
@ -157,9 +157,9 @@ const char * r3_slug_find_name(const char *s1, unsigned int str_len, unsigned in
const char * s2;
int cnt = 0;
unsigned int plholder;
if (c = r3_slug_find_placeholder(s1, str_len, &plholder)) {
if ((c = r3_slug_find_placeholder(s1, str_len, &plholder))) {
c++;
if ( s2 = strnchr(c, plholder, ':') ) {
if (( s2 = strnchr(c, plholder, ':') )) {
*len = s2 - c;
return c;
} else {