There are numerous of calls to STRLEN() throughout the tree and I think that a lot of them can be avoided. This is especially true when calling the ml_get*() functions because the buf_T struct has a member (ml_line_len) which contains the length of the line.
To demonstrate one way it could be done I have put together the following patches.
Any feedback would be welcomed. If this is something that people believe is worth pursuing I am happy to keep working on it.
Cheers
John
normal.c.9.1.0089.patch
memline.pro.9.1.0089.patch
memline.c.9.1.0089.patch
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Thanks. I think this makes sense.
I had a quick look at the patch:
@@ -5192,15 +5242,15 @@ { char_u *name; int dialog_result; + size_t len = STRLEN(_("Swap file \"")); name = alloc(STRLEN(fname) - + STRLEN(_("Swap file \"")) + + len + STRLEN(_("\" already exists!")) + 5); if (name != NULL) { STRCPY(name, _("Swap file \"")); - home_replace(NULL, fname, name + STRLEN(name), - 1000, TRUE); + home_replace(NULL, fname, name + len, 1000, TRUE); STRCAT(name, _("\" already exists!")); } dialog_result = do_dialog(VIM_WARNING,
I think here it is wrong. name + STRLEN(name) is not the same as name + len. It's missing the STRLEN(_("\" already exists!")) + 5 part.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Here are some more patches.
eval.c.9.1.0095.patch
search.c.9.1.0095.patch
edit.c.9.1.0095.patch
drawline.c.9.1.0095.patch
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
can you make a PR for this please?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
--Hi Christian,
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/vim/vim/issues/14002/1937786687%40github.com.
Closed #14002 as not planned.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
closing in favor of #14052
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()