[vlc-devel] commit: Simplify, fix and inline strcasecmp and strncasecmp ( Rémi Denis-Courmont )
Hannes Domani
ssbssa at yahoo.de
Tue May 27 12:21:21 CEST 2008
> +static inline int strcasecmp (const char *s1, const
> char *s2)
> +{
> + for (size_t i = 0;; i++)
> + {
> + int d = tolower (s1[i]) - tolower (s2[i]);
> + if (d) return d;
> + }
> + return 0;
> +}
what if s1 and s2 are equal?
> +static inline int strncasecmp (const char *s1,
> const char *s2, size_t n)
> +{
> + for (size_t i = 0; i < n; i++)
> + {
> + int d = tolower (s1[i]) - tolower (s2[i]);
> + if (d) return d;
> + }
> + return 0;
> +}
the same: what if s1 and s2 are equal and shorter than
n?
possible solution:
for (size_t i = 0; s1[i] || s2[i]; i++)
regards
Domani Johannes
__________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com
More information about the vlc-devel
mailing list