[vim/vim] Change some dict_add_string() calls to dict_add_string_len() (PR #19999)

1 view
Skip to first unread message

John Marriott

unread,
Apr 17, 2026, 9:02:59 PM (13 hours ago) Apr 17
to vim/vim, Subscribed

This PR refactors some source files to pass string length to function dict_add_string_len() where it is known or can be calculated simply.

In addition:
In textprop.c, in function prop_fill_dict() use a string_T to store local variable text_align.
In popupwin.c, use a string_T to store struct member pp_name in struct poppos_entry_T.
In mark.c, refactor function add_mark() to pass in the length of argument mname.
In insexpand.c:
->Use a string_T to store the elements of static array ctrl_x_mode_names.
->Refactor function trigger_complete_done_event():
->->change type of argument char_u *word to string_T *word.
->->make one access of array ctrl_x_mode_names instead of two.
->Refactor function ins_compl_mode() to accept a string_T to return the resulting string.
In fileio.c:
->Refactor function getftypewfd() to accept a string_T to return the resulting string.
->In function create_readdirex_item() use a string_T to store local variable q.
In cmdexpand.c, store global cmdline_orig as a string_T.
In autocmd.c, in function f_autocmd_get() use a string_T to store local variables event_name and group_name. Measure their lengths once when they are assigned so they are not remeasured on each call to dict_add_string() in the subsequent for loop.
In channel.c, in function channel_part_info() drop local variable status and use s instead. Make s a string_T.

Cheers
John


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

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

Commit Summary

  • 31f37ff Change some calls to dict_add_string() to dict_add_string_len()
  • 74948ca Small update

File Changes

(18 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/19999@github.com>

John Marriott

unread,
Apr 17, 2026, 9:49:26 PM (13 hours ago) Apr 17
to vim/vim, Push

@basilisk0315 pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19999/before/74948caec662e3d76eff11c0e6e9ff9fda01022a/after/438c78413841990452b315c3f843bb80a739616d@github.com>

Mao-Yining

unread,
7:16 AM (3 hours ago) 7:16 AM
to vim/vim, Subscribed

@mao-yining commented on this pull request.


In src/popupwin.c:

>  	    break;
 	}
 
-    dict_add_string(dict, "close", (char_u *)(
-		wp->w_popup_close == POPCLOSE_BUTTON ? "button"
-		: wp->w_popup_close == POPCLOSE_CLICK ? "click" : "none"));
+    if (wp->w_popup_close == POPCLOSE_BUTTON)
+	dict_add_string_len(dict, "close", (char_u *)"button", STRLEN_LITERAL("button"));
+    else if (wp->w_popup_close == POPCLOSE_BUTTON)
⬇️ Suggested change
-    else if (wp->w_popup_close == POPCLOSE_BUTTON)
+    else if (wp->w_popup_close == POPCLOSE_CLICK)


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/19999/review/4134235635@github.com>

Reply all
Reply to author
Forward
0 new messages