Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
7d3d3dec
Commit
7d3d3dec
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: use the logic from revstrstr() also in mbrevstrcasestr()
Because it is slightly faster.
parent
6240805c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/chars.c
+9
-9
src/chars.c
with
9 additions
and
9 deletions
+9
-9
src/chars.c
View file @
7d3d3dec
...
...
@@ -535,29 +535,29 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
{
#ifdef ENABLE_UTF8
if
(
use_utf8
)
{
size_t
tail_len
,
needle_len
;
size_t
needle_len
=
mbstrlen
(
needle
);
size_t
tail_len
=
mbstrlen
(
pointer
);
if
(
*
needle
==
'\0'
)
if
(
needle
_len
==
0
)
return
(
char
*
)
pointer
;
needle_len
=
mbstrlen
(
needle
);
if
(
mbstrlen
(
haystack
)
<
needle_len
)
return
NULL
;
tail_len
=
mbstrlen
(
pointer
);
if
(
tail_len
<
needle_len
)
pointer
+=
tail_len
-
needle_len
;
if
(
pointer
<
haystack
)
return
NULL
;
while
(
TRUE
)
{
if
(
tail_len
>=
needle_len
&&
mbstrncasecmp
(
pointer
,
needle
,
needle_len
)
==
0
)
if
(
mbstrncasecmp
(
pointer
,
needle
,
needle_len
)
==
0
)
return
(
char
*
)
pointer
;
/* If we've reached the head of the haystack, we found nothing. */
if
(
pointer
==
haystack
)
return
NULL
;
pointer
=
haystack
+
move_mbleft
(
haystack
,
pointer
-
haystack
);
tail_len
++
;
}
}
else
#endif
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment