This PR reduces the number of calls to STRLEN() in search.c. There is nothing tricky here but because all of the call sites needed to change, there are 15 source files involved.
Cheers
John
https://github.com/vim/vim/pull/14796
(15 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@basilisk0315 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.
@chrisbra commented on this pull request.
In src/cmdhist.c:
> @@ -566,7 +565,7 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv) return; init_history(); - add_to_history(histype, str, FALSE, NUL); + add_to_history(histype, str, STRLEN(str), FALSE, NUL);
Hm, that doesn't seem like a clear improvement here. Instead of calling strlen()
inside the function, you'll have to add the strlen()
when calling the function.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@basilisk0315 commented on this pull request.
In src/cmdhist.c:
> @@ -566,7 +565,7 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv) return; init_history(); - add_to_history(histype, str, FALSE, NUL); + add_to_history(histype, str, STRLEN(str), FALSE, NUL);
Yes it looks weird. However, this function is called from five places (including this one) and in the other four places the string's length in known and passed. It's only this one where STRLEN() has to be called.
A similar thing happens for other functions as well.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@chrisbra commented on this pull request.
In src/cmdhist.c:
> @@ -566,7 +565,7 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv) return; init_history(); - add_to_history(histype, str, FALSE, NUL); + add_to_history(histype, str, STRLEN(str), FALSE, NUL);
okay thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
In src/tag.c:
> tagp.tagname); - if (!do_search(NULL, '/', '/', pbuf, (long)1, + if (!do_search(NULL, '/', '/', pbuf, len, (long)1,
Why is len
used here? Shouldn't this be pbuflen
?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
In src/tag.c:
> tagp.tagname); - if (!do_search(NULL, '/', '/', pbuf, (long)1, + if (!do_search(NULL, '/', '/', pbuf, len, (long)1,
I've created PR #14817 to correct this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
--I think you're right. A typo. Sorry.
--
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/pull/14796/review/2067231278%40github.com.
@chrisbra commented on this pull request.
In src/tag.c:
> tagp.tagname); - if (!do_search(NULL, '/', '/', pbuf, (long)1, + if (!do_search(NULL, '/', '/', pbuf, len, (long)1,
sorry, I missed that during review.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.