mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Made strpbrk_or_eos a macro under Gcc.
This commit is contained in:
parent
3abcd16d79
commit
79157a03fd
@ -1,3 +1,7 @@
|
|||||||
|
2003-09-15 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* url.c (strpbrk_or_eos): Implement as a macro under Gcc.
|
||||||
|
|
||||||
2003-09-15 Hrvoje Niksic <hniksic@xemacs.org>
|
2003-09-15 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* cookies.c (parse_set_cookies): Allow trailing space in
|
* cookies.c (parse_set_cookies): Allow trailing space in
|
||||||
|
22
src/url.c
22
src/url.c
@ -616,7 +616,26 @@ static void parse_path PARAMS ((const char *, char **, char **));
|
|||||||
|
|
||||||
/* Like strpbrk, with the exception that it returns the pointer to the
|
/* Like strpbrk, with the exception that it returns the pointer to the
|
||||||
terminating zero (end-of-string aka "eos") if no matching character
|
terminating zero (end-of-string aka "eos") if no matching character
|
||||||
is found. */
|
is found.
|
||||||
|
|
||||||
|
Although I normally balk at Gcc-specific optimizations, it probably
|
||||||
|
makes sense here: glibc has optimizations that detect strpbrk being
|
||||||
|
called with literal string as ACCEPT and inline the search. That
|
||||||
|
optimization is defeated if strpbrk is hidden within the call to
|
||||||
|
another function. (And no, making strpbrk_or_eos inline doesn't
|
||||||
|
help because the check for literal accept is in the
|
||||||
|
preprocessor.) */
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
|
||||||
|
#define strpbrk_or_eos(s, accept) ({ \
|
||||||
|
char *SOE_p = strpbrk (s, accept); \
|
||||||
|
if (!SOE_p) \
|
||||||
|
SOE_p = (char *)s + strlen (s); \
|
||||||
|
SOE_p; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#else /* not __GNUC__ */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
strpbrk_or_eos (const char *s, const char *accept)
|
strpbrk_or_eos (const char *s, const char *accept)
|
||||||
@ -626,6 +645,7 @@ strpbrk_or_eos (const char *s, const char *accept)
|
|||||||
p = (char *)s + strlen (s);
|
p = (char *)s + strlen (s);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Turn STR into lowercase; return non-zero if a character was
|
/* Turn STR into lowercase; return non-zero if a character was
|
||||||
actually changed. */
|
actually changed. */
|
||||||
|
Loading…
Reference in New Issue
Block a user