Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-12 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: Making a single preparation run for counting the lines will avoid memory fragmentation. Also, fix the allocated memory size which was wrong when sizeof(int *) != sizeof(int), and would have been too small for sizeof(int *) sizeof(int), admittedly unlikely.

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-06 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: It's snake oil making debugging harder. OK, that is a sensible argument. This was fun ;-) At the expense of seriously impacting my motivation to do any further code cleanup on Git. Well, I said it was fun

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-05 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: so something like for (p = buf; p end; p++) { p = find the end of this line if (!p) break; num++; } perhaps? Would crash on incomplete

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-05 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: which I think is the prevalent style in our codebase. The same for the other loop we see in the new code below. - avoid assignments in conditionals when you do not have to. commit a77a48c259d9adbe7779ca69a3432e493116b3fd Author: Junio C Hamano

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-05 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: Junio C Hamano gits...@pobox.com writes: which I think is the prevalent style in our codebase. The same for the other loop we see in the new code below. - avoid assignments in conditionals when you do not have to. commit

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-05 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: It's snake oil making debugging harder. OK, that is a sensible argument. This was fun ;-) At the expense of seriously impacting my motivation to do any further code cleanup on Git. Well, I said it was fun because I was learning from a new person who

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-05 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: Junio C Hamano gits...@pobox.com writes: which I think is the prevalent style in our codebase. The same for the other loop we see in the new code below. - avoid assignments in conditionals when you do not have

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-05 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: It's snake oil making debugging harder. OK, that is a sensible argument. This was fun ;-) At the expense of seriously impacting my motivation to do any further code cleanup on Git. Well, I said it was fun

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread David Kastrup
Whitespace error in line 1778. Should I be reposting? -- David Kastrup -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: Making a single preparation run for counting the lines will avoid memory fragmentation. Also, fix the allocated memory size which was wrong when sizeof(int *) != sizeof(int), and would have been too small for sizeof(int *) sizeof(int), admittedly unlikely.

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: Whitespace error in line 1778. Should I be reposting? Heh, let me try to clean it up first and then repost for your review. Thanks. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: Making a single preparation run for counting the lines will avoid memory fragmentation. Also, fix the allocated memory size which was wrong when sizeof(int *) != sizeof(int), and would have been too small for

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: Whitespace error in line 1778. Should I be reposting? Heh, let me try to clean it up first and then repost for your review. Thanks. -- 8 -- From: David Kastrup d...@gnu.org Making a single preparation run for

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: Anybody know offhand what I should be including here? It looks like Git has some fallback definitions of its own, so it's probably not just string.h I should include? In general, no *.c files outside the compatibility layer should include anything #include

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: Whitespace error in line 1778. Should I be reposting? Heh, let me try to clean it up first and then repost for your review. Thanks. -- 8 -- From: David Kastrup

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: Anybody know offhand what I should be including here? It looks like Git has some fallback definitions of its own, so it's probably not just string.h I should include? In general, no *.c files outside the

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: Making a single preparation run for counting the lines will avoid memory fragmentation. Also, fix the allocated memory size which was wrong when sizeof(int *) != sizeof(int), and would have been too small for

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: Anybody know offhand what I should be including here? It looks like Git has some fallback definitions of its own, so it's probably not just string.h I should include? In

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: Ok, I now wrote for (p = buf;; num++, p++) { p = memchr(p, '\n', end - p); if (!p) break; } Looks still wrong (perhaps this is a taste issue). num++ is not loop control, but the real

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes: David Kastrup d...@gnu.org writes: Ok, I now wrote for (p = buf;; num++, p++) { p = memchr(p, '\n', end - p); if (!p) break; } Looks still wrong (perhaps this is a taste issue).

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Junio C Hamano
David Kastrup d...@gnu.org writes: so something like for (p = buf; p end; p++) { p = find the end of this line if (!p) break; num++; } perhaps? Would crash on incomplete last line. Hmph, even with if !p? From

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Philip Oakley
From: David Kastrup d...@gnu.org To: Junio C Hamano gits...@pobox.com Cc: git@vger.kernel.org Sent: Tuesday, February 04, 2014 9:09 PM Subject: Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line Junio C Hamano gits...@pobox.com writes: Junio C Hamano gits

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

2014-02-04 Thread Philip Oakley
From: Philip Oakley philipoak...@iee.org From: David Kastrup d...@gnu.org To: Junio C Hamano gits...@pobox.com Cc: git@vger.kernel.org Sent: Tuesday, February 04, 2014 9:09 PM Subject: Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line [...] Where's the difference