mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
CLEANUP: sample: Explicitly handle all possible enum values from mjson
This makes it easier to find bugs, because -Wswitch can help us.
This commit is contained in:
parent
4809c8c955
commit
8f3bc8ffca
1 changed files with 13 additions and 2 deletions
15
src/sample.c
15
src/sample.c
|
|
@ -3774,8 +3774,19 @@ static int sample_conv_json_query(const struct arg *args, struct sample *smp, vo
|
|||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
/* no valid token found */
|
||||
case MJSON_TOK_NULL:
|
||||
case MJSON_TOK_ARRAY:
|
||||
case MJSON_TOK_OBJECT:
|
||||
/* We cannot handle these. */
|
||||
return 0;
|
||||
case MJSON_TOK_INVALID:
|
||||
/* Nothing matches the query. */
|
||||
return 0;
|
||||
case MJSON_TOK_KEY:
|
||||
/* This is not a valid return value according to the
|
||||
* mjson documentation, but we handle it to benefit
|
||||
* from '-Wswitch'.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue