Skip to content

Commit 56bea28

Browse files
committed
pkt-line: drop 'const'-ness of a param to set_packet_header()
The function's definition has a paramter of type "int" qualified as "const". The fact that the incoming parameter is used as read-only in the fuction is an implementation detail that the callers should not have to be told in the prototype declaring it (and "const" there has no effect, as C passes parameters by value). The prototype defined for the function in pkt-line.h lacked the matching "const" for this reason, but apparently some compilers (e.g. MS Visual C 2017) complain about the parameter type mismatch. Let's squelch it by removing the "const" that is pointless in the definition of a small and trivial function like this, which would not help optimizing compilers nor reading humans that much. Noticed-by: Johannes Schindelin <[email protected]> Helped-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ab15ad1 commit 56bea28

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkt-line.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void packet_buf_delim(struct strbuf *buf)
119119
strbuf_add(buf, "0001", 4);
120120
}
121121

122-
void set_packet_header(char *buf, const int size)
122+
void set_packet_header(char *buf, int size)
123123
{
124124
static char hexchar[] = "0123456789abcdef";
125125

0 commit comments

Comments
 (0)