summaryrefslogtreecommitdiff
path: root/pkt-line.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-15 01:42:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-16 04:29:06 (GMT)
commit56bea280365238f0313f177b66fda6f87049d094 (patch)
tree38b0bc907b6962db065d306aadf553833de0a123 /pkt-line.c
parentab15ad1a3b4b04a29415aef8c9afa2f64fc194a2 (diff)
downloadgit-56bea280365238f0313f177b66fda6f87049d094.zip
git-56bea280365238f0313f177b66fda6f87049d094.tar.gz
git-56bea280365238f0313f177b66fda6f87049d094.tar.bz2
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 <johannes.schindelin@gmx.de> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pkt-line.c')
-rw-r--r--pkt-line.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkt-line.c b/pkt-line.c
index c9ed780..a0e87b1 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -119,7 +119,7 @@ void packet_buf_delim(struct strbuf *buf)
strbuf_add(buf, "0001", 4);
}
-void set_packet_header(char *buf, const int size)
+void set_packet_header(char *buf, int size)
{
static char hexchar[] = "0123456789abcdef";