diff options
| author | jvoisin | 2017-10-23 23:40:06 +0200 |
|---|---|---|
| committer | jvoisin | 2017-10-23 23:40:06 +0200 |
| commit | ca51803abbe0b5605f936f5676d9c1a528713033 (patch) | |
| tree | d93df6521a23882b8f3d44c06326574b3c66cb35 /src/sp_config_utils.c | |
| parent | 2c4251457f519e02bda073cbeb88c6d9778fa9ba (diff) | |
Add a test for unmatched brackets
Diffstat (limited to 'src/sp_config_utils.c')
| -rw-r--r-- | src/sp_config_utils.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/sp_config_utils.c b/src/sp_config_utils.c index f562ffd..62fb7c1 100644 --- a/src/sp_config_utils.c +++ b/src/sp_config_utils.c | |||
| @@ -2,9 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | size_t sp_line_no; | 3 | size_t sp_line_no; |
| 4 | 4 | ||
| 5 | static int validate_str(const char *value); | 5 | static int validate_str(const char *value) { |
| 6 | |||
| 7 | static sp_pure int validate_str(const char *value) { | ||
| 8 | int balance = 0; // ghetto [] validation | 6 | int balance = 0; // ghetto [] validation |
| 9 | 7 | ||
| 10 | if (!strchr(value, '[')) { | 8 | if (!strchr(value, '[')) { |
| @@ -18,6 +16,7 @@ static sp_pure int validate_str(const char *value) { | |||
| 18 | balance--; | 16 | balance--; |
| 19 | } | 17 | } |
| 20 | if (balance < 0) { | 18 | if (balance < 0) { |
| 19 | sp_log_err("config", "The string '%s' contains unbalanced brackets.", value); | ||
| 21 | return -1; | 20 | return -1; |
| 22 | } | 21 | } |
| 23 | } | 22 | } |
