From 2098b9a8f30fcbdff71aa5c0bcaf064472d192b1 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 28 Jun 2012 09:08:18 +0100 Subject: fold state 0 and 1 together and reduce logically --- src/common.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/common.c') diff --git a/src/common.c b/src/common.c index b803e87..98e5452 100644 --- a/src/common.c +++ b/src/common.c @@ -128,15 +128,15 @@ unsigned int wg_split(char **result, char *dest, char *src, int maxsegments) { p++; } - state = 1; - case 1: /*** Start segment ***/ result[cnt] = w; cnt++; - state = 2; + state = 1; - case 2: + /*** fall through **/ + + case 1: /*** Unquoted segment ***/ while (*p) { @@ -151,7 +151,7 @@ unsigned int wg_split(char **result, char *dest, char *src, int maxsegments) { /*** Start quotation ***/ p++; - state = 3; + state = 2; break; } else if (*p == '\\' && p[1]) @@ -167,7 +167,7 @@ unsigned int wg_split(char **result, char *dest, char *src, int maxsegments) } break; - case 3: + case 2: /*** Inside quotes ***/ while (*p) { @@ -187,7 +187,7 @@ unsigned int wg_split(char **result, char *dest, char *src, int maxsegments) *w++ = *p++; } } - state = 2; + state = 1; break; } -- cgit v1.2.3