summaryrefslogtreecommitdiff
path: root/epan/wmem/wmem_strutl.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-06-19 06:48:08 +0000
committerEvan Huus <eapache@gmail.com>2013-06-19 06:48:08 +0000
commitf4e5a623258cc9ca5dd10a075a95be1780c73db7 (patch)
treeb0dee62a65117a180937d83d0c4f2846a4584771 /epan/wmem/wmem_strutl.c
parent830ebed40611e8c215779778a957bc2b5bf9fff7 (diff)
downloadwireshark-f4e5a623258cc9ca5dd10a075a95be1780c73db7.tar.gz
Clean up wmem_strsplit to remove a bunch of weird switch statements and
unnecessary continue statements. Should fix the coverity issues Joerg pointed out as well. svn path=/trunk/; revision=50033
Diffstat (limited to 'epan/wmem/wmem_strutl.c')
-rw-r--r--epan/wmem/wmem_strutl.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/epan/wmem/wmem_strutl.c b/epan/wmem/wmem_strutl.c
index 831d05160f..b129d19ef7 100644
--- a/epan/wmem/wmem_strutl.c
+++ b/epan/wmem/wmem_strutl.c
@@ -173,32 +173,27 @@ wmem_strsplit(wmem_allocator_t *allocator, const gchar *src,
for (i=0; i< str_len; i++) {
switch(state) {
case AT_START:
- switch(splitted[i]) {
- case '\0':
- state = IN_PAD;
- continue;
- default:
- vec[curr_tok] = &(splitted[i]);
- curr_tok++;
- state = IN_TOKEN;
- continue;
+ if (splitted[i] == '\0') {
+ state = IN_PAD;
}
+ else {
+ vec[curr_tok] = &(splitted[i]);
+ curr_tok++;
+ state = IN_TOKEN;
+ }
+ break;
case IN_TOKEN:
- switch(splitted[i]) {
- case '\0':
- state = IN_PAD;
- default:
- continue;
+ if (splitted[i] == '\0') {
+ state = IN_PAD;
}
+ break;
case IN_PAD:
- switch(splitted[i]) {
- default:
- vec[curr_tok] = &(splitted[i]);
- curr_tok++;
- state = IN_TOKEN;
- case '\0':
- continue;
+ if (splitted[i] != '\0') {
+ vec[curr_tok] = &(splitted[i]);
+ curr_tok++;
+ state = IN_TOKEN;
}
+ break;
}
}