Skip to content

Commit d0e9983

Browse files
peffgitster
authored andcommitted
curl_trace(): eliminate switch fallthrough
Our trace handler is called by curl with a curl_infotype variable to interpret its data field. For most types we print the data and then break out of the switch. But for CURLINFO_TEXT, we print data and then fall through to the "default" case, which does the exact same thing (nothing!) that breaking out of the switch would. This is probably a leftover from an early iteration of the patch where the code after the switch _did_ do something interesting that was unique to the non-text case arms. But in its current form, this fallthrough is merely confusing (and causes gcc's -Wimplicit-fallthrough to complain). Let's make CURLINFO_TEXT like the other case arms, and push the default arm to the end where it's more obviously a catch-all. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8968b7b commit d0e9983

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

http.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,7 @@ static int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size,
638638
switch (type) {
639639
case CURLINFO_TEXT:
640640
trace_printf_key(&trace_curl, "== Info: %s", data);
641-
default: /* we ignore unknown types by default */
642-
return 0;
643-
641+
break;
644642
case CURLINFO_HEADER_OUT:
645643
text = "=> Send header";
646644
curl_dump_header(text, (unsigned char *)data, size, DO_FILTER);
@@ -665,6 +663,9 @@ static int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size,
665663
text = "<= Recv SSL data";
666664
curl_dump_data(text, (unsigned char *)data, size);
667665
break;
666+
667+
default: /* we ignore unknown types by default */
668+
return 0;
668669
}
669670
return 0;
670671
}

0 commit comments

Comments
 (0)