diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-02-26 23:04:13 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-02-26 23:04:13 +0000 |
commit | 05159a0c6a27a030c8497c5cf836977090f9e75d (patch) | |
tree | 9ccc167cf3e830e5d01aff4555f99d854cbb623b /src/misc2.c | |
parent | 5313dcb75ac76501f23d21ac94efdbeeabc860bc (diff) | |
download | vim-git-05159a0c6a27a030c8497c5cf836977090f9e75d.tar.gz |
updated for version 7.0052v7.0052
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/src/misc2.c b/src/misc2.c index d647fc7ac..d5a80929b 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1374,8 +1374,8 @@ vim_stristr(s1, s2) /* * Version of strchr() and strrchr() that handle unsigned char strings - * with characters above 128 correctly. Also it doesn't return a pointer to - * the NUL at the end of the string. + * with characters from 128 to 255 correctly. It also doesn't return a + * pointer to the NUL at the end of the string. */ char_u * vim_strchr(string, c) @@ -1431,9 +1431,30 @@ vim_strchr(string, c) } /* + * Version of strchr() that only works for bytes and handles unsigned char + * strings with characters above 128 correctly. It also doesn't return a + * pointer to the NUL at the end of the string. + */ + char_u * +vim_strbyte(string, c) + char_u *string; + int c; +{ + char_u *p = string; + + while (*p != NUL) + { + if (*p == c) + return p; + ++p; + } + return NULL; +} + +/* * Search for last occurrence of "c" in "string". * return NULL if not found. - * Does not handle multi-byte! + * Does not handle multi-byte char for "c"! */ char_u * vim_strrchr(string, c) @@ -1441,12 +1462,13 @@ vim_strrchr(string, c) int c; { char_u *retval = NULL; + char_u *p = string; - while (*string) + while (*p) { - if (*string == c) - retval = string; - mb_ptr_adv(string); + if (*p == c) + retval = p; + mb_ptr_adv(p); } return retval; } @@ -2549,6 +2571,9 @@ call_shell(cmd, opt) { char_u *ncmd; int retval; +#ifdef FEAT_PROFILE + proftime_T wait_time; +#endif if (p_verbose > 3) { @@ -2558,6 +2583,11 @@ call_shell(cmd, opt) cursor_on(); } +#ifdef FEAT_PROFILE + if (do_profiling) + prof_child_enter(&wait_time); +#endif + if (*p_sh == NUL) { EMSG(_(e_shellempty)); @@ -2603,6 +2633,10 @@ call_shell(cmd, opt) #ifdef FEAT_EVAL set_vim_var_nr(VV_SHELL_ERROR, (long)retval); +# ifdef FEAT_PROFILE + if (do_profiling) + prof_child_exit(&wait_time); +# endif #endif return retval; |