[vim/vim] Call ga_concat_len() where the length is known (PR #19027)

8 views
Skip to first unread message

John Marriott

unread,
Dec 26, 2025, 4:23:42 PM (2 days ago) Dec 26
to vim/vim, Subscribed

This PR changes calls in some source files from ga_concat() to ga_concat_len() where the length is known.

Cheers
John


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19027

Commit Summary

  • 927f192 Call ga_concat_len() where the length is known

File Changes

(10 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027@github.com>

zeertzjq

unread,
Dec 26, 2025, 6:20:40 PM (2 days ago) Dec 26
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/userfunc.c:

> @@ -1405,7 +1405,7 @@ get_function_body(
 	    // For a :def function "python << EOF" concatenates all the lines,
 	    // to be used for the instruction later.
 	    ga_concat(&heredoc_ga, theline);
-	    ga_concat(&heredoc_ga, (char_u *)"\n");
+	    ga_concat_len(&heredoc_ga, (char_u *)"\n", 1);	// Note: not 1!

?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/review/3613945054@github.com>

zeertzjq

unread,
Dec 26, 2025, 6:21:46 PM (2 days ago) Dec 26
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#19027)

I don't think these "Note:" lines are necessary. Anyone knows \n is a single character.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/c3693468716@github.com>

John Marriott

unread,
Dec 26, 2025, 6:38:48 PM (2 days ago) Dec 26
to vim/vim, Subscribed
basilisk0315 left a comment (vim/vim#19027)

I don't think these "Note:" lines are necessary. Anyone knows \n is a single character.

Yeah, you're probably right. I will remove them.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/c3693480137@github.com>

John Marriott

unread,
Dec 26, 2025, 6:54:35 PM (2 days ago) Dec 26
to vim/vim, Push

@basilisk0315 pushed 2 commits.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/before/927f192dc8edf46005712ea7f41cc6c795212863/after/cb35ef36e4e477eeda7e400769ebc76fa05b8705@github.com>

Christian Brabandt

unread,
Dec 27, 2025, 10:27:19 AM (24 hours ago) Dec 27
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In src/cmdexpand.c:

> @@ -4773,10 +4773,13 @@ copy_substring_from_pos(pos_T *start, pos_T *end, char_u **match,
     {
 	for (lnum = start->lnum + 1; lnum < end->lnum; lnum++)
 	{
+	    size_t  linelen;
⬇️ Suggested change
-	    size_t  linelen;
+	    int  linelen;

In src/cmdexpand.c:

>  	    line = ml_get(lnum);
-	    if (ga_grow(&ga, ml_get_len(lnum) + 2) != OK)
+	    linelen = ml_get_len(lnum);
+	    if (ga_grow(&ga, linelen + 2) != OK)

this causes compile error on Windows: https://ci.appveyor.com/project/chrisbra/vim/builds/53292699#L76
Probably changing linelen to int should be sufficient.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/review/3614352425@github.com>

John Marriott

unread,
Dec 27, 2025, 2:00:42 PM (20 hours ago) Dec 27
to vim/vim, Push

@basilisk0315 pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/before/cb35ef36e4e477eeda7e400769ebc76fa05b8705/after/03fe1f7197ddb5df4f5ebc940809bf6b61858dcb@github.com>

John Marriott

unread,
Dec 27, 2025, 2:00:55 PM (20 hours ago) Dec 27
to vim/vim, Subscribed

@basilisk0315 commented on this pull request.


In src/cmdexpand.c:

>  	    line = ml_get(lnum);
-	    if (ga_grow(&ga, ml_get_len(lnum) + 2) != OK)
+	    linelen = ml_get_len(lnum);
+	    if (ga_grow(&ga, linelen + 2) != OK)

No worries.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/review/3614405992@github.com>

Christian Brabandt

unread,
9:13 AM (1 hour ago) 9:13 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19027)

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/c3694777309@github.com>

Christian Brabandt

unread,
9:20 AM (1 hour ago) 9:20 AM
to vim/vim, Subscribed

Closed #19027 via 32b801a.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19027/issue_event/21770093810@github.com>

Reply all
Reply to author
Forward
0 new messages