diff options
| author | jvoisin | 2017-12-21 12:08:39 +0100 |
|---|---|---|
| committer | jvoisin | 2017-12-21 12:55:19 +0100 |
| commit | e0c98a94adc1d07313c32684a1b00c4dd7c990de (patch) | |
| tree | 1db6de135503c559d81a77e03a113f4c8ba7e2aa /src/sp_var_parser.c | |
| parent | 8a32063601a9a35c4cc888868d4f29ee4931eb8b (diff) | |
Re-indent a bit a function
Diffstat (limited to 'src/sp_var_parser.c')
| -rw-r--r-- | src/sp_var_parser.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/sp_var_parser.c b/src/sp_var_parser.c index f5d54eb..b6dde03 100644 --- a/src/sp_var_parser.c +++ b/src/sp_var_parser.c | |||
| @@ -179,28 +179,27 @@ static sp_tree *parse_tokens(const char * restrict str, | |||
| 179 | } | 179 | } |
| 180 | if (ignore == 0) { | 180 | if (ignore == 0) { |
| 181 | if (token->type == ARRAY) { | 181 | if (token->type == ARRAY) { |
| 182 | pos_idx_start = (array_count) ? pos_idx_start : | 182 | pos_idx_start = (array_count) ? pos_idx_start : (int)(token->pos + strlen(token->token)); |
| 183 | (int)(token->pos + strlen(token->token)); | 183 | array_count++; |
| 184 | array_count++; | ||
| 185 | } else if (token->type == ARRAY_END) { | 184 | } else if (token->type == ARRAY_END) { |
| 186 | array_count--; | 185 | array_count--; |
| 187 | token->type = ARRAY; | 186 | token->type = ARRAY; |
| 188 | } | 187 | } |
| 189 | if (array_count == 0) { | 188 | if (array_count == 0) { |
| 190 | value_len = token->pos - pos; | 189 | value_len = token->pos - pos; |
| 191 | if (token->type == ARRAY) { | 190 | if (token->type == ARRAY) { |
| 192 | value_len -= strlen(token->token); | 191 | value_len -= strlen(token->token); |
| 193 | } | 192 | } |
| 194 | if (pos_idx_start > 0) { | 193 | if (pos_idx_start > 0) { |
| 195 | idx = estrndup(&(str[pos_idx_start]), token->pos - pos_idx_start); | 194 | idx = estrndup(&(str[pos_idx_start]), token->pos - pos_idx_start); |
| 196 | value_len -= token->pos - pos_idx_start; | 195 | value_len -= token->pos - pos_idx_start; |
| 197 | } | 196 | } |
| 198 | if (create_var(tree, &str[pos], value_len, token->type, idx)) { | 197 | if (create_var(tree, &str[pos], value_len, token->type, idx)) { |
| 199 | goto error; | 198 | goto error; |
| 200 | } | 199 | } |
| 201 | efree(idx); | 200 | efree(idx); |
| 202 | pos = token->pos + strlen(token->token); | 201 | pos = token->pos + strlen(token->token); |
| 203 | pos_idx_start = -1; | 202 | pos_idx_start = -1; |
| 204 | } | 203 | } |
| 205 | } | 204 | } |
| 206 | } | 205 | } |
