This commit is contained in:
hyung-hwan 2008-04-02 02:37:30 +00:00
parent abd2477aa6
commit bc23bf3d3e
2 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: str.h 149 2008-03-20 09:49:53Z baconevi $
* $Id: str.h 159 2008-04-01 08:37:30Z baconevi $
*
* {License}
*/
@ -101,9 +101,11 @@ ase_size_t ase_strxncat (
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str, ase_size_t len);
int ase_strcmp (const ase_char_t* s1, const ase_char_t* s2);
int ase_strxcmp (const ase_char_t* s1, ase_size_t len1, const ase_char_t* s2);
int ase_strxncmp (
const ase_char_t* s1, ase_size_t len1,
const ase_char_t* s2, ase_size_t len2);
int ase_strcasecmp (
const ase_char_t* s1, const ase_char_t* s2, ase_ccls_t* ccls);
int ase_strxncasecmp (

View File

@ -1,5 +1,5 @@
/*
* $Id: str_bas.c 149 2008-03-20 09:49:53Z baconevi $
* $Id: str_bas.c 159 2008-04-01 08:37:30Z baconevi $
*
* {License}
*/
@ -137,13 +137,22 @@ int ase_strcmp (const ase_char_t* s1, const ase_char_t* s2)
{
while (*s1 == *s2)
{
if (*s1 == ASE_C('\0')) return 0;
if (*s1 == ASE_T('\0')) return 0;
s1++, s2++;
}
return (*s1 > *s2)? 1: -1;
}
int ase_strxcmp (const ase_char_t* s1, ase_size_t len, const ase_char_t* s2)
{
const ase_char_t* end = s1 + len;
while (s1 < end && *s2 != ASE_T('\0') && *s1 == *s2) s1++, s2++;
if (s1 == end && *s2 == ASE_T('\0')) return 0;
if (*s1 == *s2) return (s1 < end)? 1: -1;
return (*s1 > *s2)? 1: -1;
}
int ase_strxncmp (
const ase_char_t* s1, ase_size_t len1,
const ase_char_t* s2, ase_size_t len2)