From bc23bf3d3e3bd63e177e75c3c54a70be68a5cb5e Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 2 Apr 2008 02:37:30 +0000 Subject: [PATCH] --- ase/cmn/str.h | 4 +++- ase/cmn/str_bas.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ase/cmn/str.h b/ase/cmn/str.h index 558f4f8a..0ff4f4e1 100644 --- a/ase/cmn/str.h +++ b/ase/cmn/str.h @@ -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 ( diff --git a/ase/cmn/str_bas.c b/ase/cmn/str_bas.c index b31c5265..968f2f76 100644 --- a/ase/cmn/str_bas.c +++ b/ase/cmn/str_bas.c @@ -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)