summaryrefslogtreecommitdiff
path: root/src/common.c
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-28 09:08:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-06-28 09:08:18 +0100
commit2098b9a8f30fcbdff71aa5c0bcaf064472d192b1 (patch)
treef6a1998d6bd261f3c737b6326375ea05cd3a4015 /src/common.c
parent980592386f23db8b0dc84c434805cb167d0cc091 (diff)
fold state 0 and 1 together and reduce logically
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c14
1 files changed, 7 insertions, 7 deletions
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;
}