Commit a8342a41 authored by René Scharfe's avatar René Scharfe Committed by Junio C Hamano

strbuf: use valid pointer in strbuf_remove()

The fourth argument of strbuf_splice() is passed to memcpy(3), which is
not supposed to handle NULL pointers.  Let's be extra careful and use a
valid empty string instead.  It even shortens the source code. :)
Signed-off-by: default avatarRene Scharfe <l.s.r@web.de>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 0b65a8db
...@@ -187,7 +187,7 @@ void strbuf_insert(struct strbuf *sb, size_t pos, const void *data, size_t len) ...@@ -187,7 +187,7 @@ void strbuf_insert(struct strbuf *sb, size_t pos, const void *data, size_t len)
void strbuf_remove(struct strbuf *sb, size_t pos, size_t len) void strbuf_remove(struct strbuf *sb, size_t pos, size_t len)
{ {
strbuf_splice(sb, pos, len, NULL, 0); strbuf_splice(sb, pos, len, "", 0);
} }
void strbuf_add(struct strbuf *sb, const void *data, size_t len) void strbuf_add(struct strbuf *sb, const void *data, size_t len)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment