Merge remote-tracking branch 'origin/master' into topic/seth/stats-improvement

This commit is contained in:
Seth Hall 2016-05-02 14:34:29 -04:00
commit d9d579c52c
416 changed files with 12813 additions and 3278 deletions

View file

@ -328,24 +328,6 @@ string to_upper(const std::string& s)
return t;
}
const char* strchr_n(const char* s, const char* end_of_s, char ch)
{
for ( ; s < end_of_s; ++s )
if ( *s == ch )
return s;
return 0;
}
const char* strrchr_n(const char* s, const char* end_of_s, char ch)
{
for ( --end_of_s; end_of_s >= s; --end_of_s )
if ( *end_of_s == ch )
return end_of_s;
return 0;
}
int decode_hex(char ch)
{
if ( ch >= '0' && ch <= '9' )
@ -387,27 +369,6 @@ const char* strpbrk_n(size_t len, const char* s, const char* charset)
return 0;
}
int strcasecmp_n(int b_len, const char* b, const char* t)
{
if ( ! b )
return -1;
int i;
for ( i = 0; i < b_len; ++i )
{
char c1 = islower(b[i]) ? toupper(b[i]) : b[i];
char c2 = islower(t[i]) ? toupper(t[i]) : t[i];
if ( c1 < c2 )
return -1;
if ( c1 > c2 )
return 1;
}
return t[i] != '\0';
}
#ifndef HAVE_STRCASESTR
// This code is derived from software contributed to BSD by Chris Torek.
char* strcasestr(const char* s, const char* find)
@ -426,7 +387,7 @@ char* strcasestr(const char* s, const char* find)
if ( sc == 0 )
return 0;
} while ( char(tolower((unsigned char) sc)) != c );
} while ( strcasecmp_n(len, s, find) != 0 );
} while ( strncasecmp(s, find, len) != 0 );
--s;
}