Re: [PATCH v8 1/4] sha1_file.c: support reading from a loose object of unknown type

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH v8 1/4] sha1_file.c: support reading from a loose object of unknown type

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:04:28

karthik nayak [off-list ref] writes:
+       type = type_from_string_gently(buf, len, 1);
+       if (oi->typename) {
+               strbuf_add(oi->typename, buf, len);
+               strbuf_addch(oi->typename, '\0');
add() has setlen() at the end so you do not have to NUL terminate it
yourself.  Doing addch() is actively wrong, as oi->typename->len now
counts the terminating NUL as part of the string, no?

Re: [PATCH v8 1/4] sha1_file.c: support reading from a loose object of unknown type

From: karthik nayak <hidden>
Date: 2016-06-15 23:04:28


On 04/18/2015 12:53 AM, Junio C Hamano wrote:
karthik nayak [off-list ref] writes:
quoted
+       type = type_from_string_gently(buf, len, 1);
+       if (oi->typename) {
+               strbuf_add(oi->typename, buf, len);
+               strbuf_addch(oi->typename, '\0');
add() has setlen() at the end so you do not have to NUL terminate it
yourself.  Doing addch() is actively wrong, as oi->typename->len now
counts the terminating NUL as part of the string, no?
Yes. was speculative of that. thanks for clearing it up.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help