diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-09-28 14:47:53 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-28 14:47:53 +0900 |
commit | 59373a4e03e273841c6c3b7fc9ac29c0a3e90c6d (patch) | |
tree | 68bf3a94d919657469c3fdb7ad2204761571c9bf /t | |
parent | Merge branch 'jk/diff-blob' (diff) | |
parent | consistently use "fallthrough" comments in switches (diff) | |
download | tgif-59373a4e03e273841c6c3b7fc9ac29c0a3e90c6d.tar.xz |
Merge branch 'jk/fallthrough'
Many codepaths have been updated to squelch -Wimplicit-fallthrough
warnings from Gcc 7 (which is a good code hygiene).
* jk/fallthrough:
consistently use "fallthrough" comments in switches
curl_trace(): eliminate switch fallthrough
test-line-buffer: simplify command parsing
Diffstat (limited to 't')
-rw-r--r-- | t/helper/test-line-buffer.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/t/helper/test-line-buffer.c b/t/helper/test-line-buffer.c index 81575fe2ab..078dd7e29d 100644 --- a/t/helper/test-line-buffer.c +++ b/t/helper/test-line-buffer.c @@ -17,27 +17,17 @@ static uint32_t strtouint32(const char *s) static void handle_command(const char *command, const char *arg, struct line_buffer *buf) { - switch (*command) { - case 'b': - if (starts_with(command, "binary ")) { - struct strbuf sb = STRBUF_INIT; - strbuf_addch(&sb, '>'); - buffer_read_binary(buf, &sb, strtouint32(arg)); - fwrite(sb.buf, 1, sb.len, stdout); - strbuf_release(&sb); - return; - } - case 'c': - if (starts_with(command, "copy ")) { - buffer_copy_bytes(buf, strtouint32(arg)); - return; - } - case 's': - if (starts_with(command, "skip ")) { - buffer_skip_bytes(buf, strtouint32(arg)); - return; - } - default: + if (starts_with(command, "binary ")) { + struct strbuf sb = STRBUF_INIT; + strbuf_addch(&sb, '>'); + buffer_read_binary(buf, &sb, strtouint32(arg)); + fwrite(sb.buf, 1, sb.len, stdout); + strbuf_release(&sb); + } else if (starts_with(command, "copy ")) { + buffer_copy_bytes(buf, strtouint32(arg)); + } else if (starts_with(command, "skip ")) { + buffer_skip_bytes(buf, strtouint32(arg)); + } else { die("unrecognized command: %s", command); } } |