git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Increase length of function name buffer

From
Junio C Hamano <junkio@cox.net>
Date
Nov 24, 2006, 06:47 UTC
Message-ID
<7vk61le3xr.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vbqmxkhpk.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 5 quoted lines
> Andy Parkins <andyparkins@gmail.com> writes:
>
>> In xemit.c:xdl_emit_diff() a buffer for showing the function name as
>> commentary is allocated; this buffer was 40 characters.  This is a bit
>> small;...
 >...
> I wonder however which is easier to read, a loooong heading line
> as you do in this patch, or "...TailOfVeryLongClassName::method"
> that still fits on a single line without terminal line-wrapping.
Nah, I was stupid again.

It would give something silly like the attached patch if we do what I suggested (notice the function header line which does not give us anything useful).

Will apply your version as is.
---
diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index 07995ec..30d3df1 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -87,8 +87,10 @@ long i, char *buf, long sz, long *ll) {
 		    (isalpha((unsigned char)*rec) || /* identifier? */
 		     *rec == '_' ||	/* also identifier? */
 		     *rec == '$')) {	/* mysterious GNU diff's invention */
-			if (len > sz)
+			if (len > sz) {
+				rec += len - sz;
 				len = sz;
+			}
 			while (0 < len && isspace((unsigned char)rec[len - 1]))
 				len--;
 			memcpy(buf, rec, len);
Previous: Junio C Hamano
Message 3 of 3 in “Increase length of function name buffer”
  1. Increase length of function name bufferAndy Parkins, Nov 23, 2006
  2. Junio C HamanoNov 23, 2006
  3. Junio C HamanoNov 24, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.