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

Re: [PATCH 1/2] FIX: use utf8_strnwidth for line_prefix in diff.c

From
MHMd Isfarul Haque <isfarul.876@gmail.com>
Date
Jan 25, 2024, 05:42 UTC
Message-ID
<d135a291-7b51-4cd6-86ec-676c1c5b04e9@gmail.com>
In-Reply-To
<CAP8UFD2oxpefhGtH61wZvcHEvd24jtu_ZBVsnNZMjD2aM_NDcg@mail.gmail.com>
On 1/25/24 01:31, Christian Couder wrote:
Show 14 quoted lines
> On Wed, Jan 24, 2024 at 3:04 PM Md Isfarul Haque via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>>
>> From: Md Isfarul Haque <isfarul.876@gmail.com>
>>
>> This patch adresses diff.c:2721 and proposes the fix using a new function.
> 
> Please give more details here about what is currently at diff.c:2721
> and what the patch is fixing, as lines at diff.c:2721 could move to a
> different location if some changes are made to diff.c before your
> patches get merged or after they get merged.
> 
> Also if the patch is addressing an issue in a code comment I would
> expect the corresponding code comment to be removed by the patch.
I understand and apologize for the mess-up. I will keep it in mind next time. 
Show 20 quoted lines
> About the subject, maybe "diff: use utf8_strnwidth() for line_prefix"
> is already better.
> 
>> Signed-off-by: Md Isfarul Haque <isfarul.876@gmail.com>
>> ---
>>  diff.c | 18 ++++++++++++++++--
>>  diff.h |  1 +
>>  2 files changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/diff.c b/diff.c
>> index a89a6a6128a..e3223b8ce5b 100644
>> --- a/diff.c
>> +++ b/diff.c
>> @@ -2300,6 +2300,20 @@ const char *diff_line_prefix(struct diff_options *opt)
>>         return msgbuf->buf;
>>  }
>>
>> +const struct strbuf *diff_line_prefix_buf(struct diff_options *opt)
> 
> This function seems to be used only in diff.c, so it could be static.

As Junio pointed out, I will probably use the existing function with slight modifications and use it. Besides, having unnecessary allocations and frees will probably only add overhead.

-- 
Thanks and regards
Md. Isfarul Haque
Previous: Christian CouderNext: Junio C Hamano
Message 4 of 9 in “FIX: use utf8_strnwidth for line_prefix in diff.c”
  1. 0/2 [GSoC][RFC/Patch] FIX: use utf8_strnwidth for line_prefix in diff.cMd Isfarul Haque via GitGitGadget, Jan 24, 2024
  2. 1/2 FIX: use utf8_strnwidth for line_prefix in diff.cMd Isfarul Haque via GitGitGadget, Jan 24, 2024
  3. Christian CouderJan 24, 2024
  4. Md Isfarul HaqueJan 25, 2024
  5. Junio C HamanoJan 24, 2024
  6. Md Isfarul HaqueJan 25, 2024
  7. 2/2 FIX memory leak in one branchMd Isfarul Haque via GitGitGadget, Jan 24, 2024
  8. Junio C HamanoJan 24, 2024
  9. Junio C HamanoJan 24, 2024

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.