Changeset 1757 for pjproject/trunk/pjlib/src/pj/string.c
- Timestamp:
- Jan 26, 2008 10:45:52 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/string.c
r1210 r1757 27 27 # include <pj/string_i.h> 28 28 #endif 29 30 31 PJ_DEF(char*) pj_strstr(const pj_str_t *str, const pj_str_t *substr) 32 { 33 const char *s, *ends; 34 35 /* Special case when substr is zero */ 36 if (substr->slen == 0) { 37 return (char*)str->ptr; 38 } 39 40 s = str->ptr; 41 ends = str->ptr + str->slen - substr->slen; 42 for (; s<=ends; ++s) { 43 if (pj_ansi_strncmp(s, substr->ptr, substr->slen)==0) 44 return (char*)s; 45 } 46 return NULL; 47 } 48 49 50 PJ_DEF(char*) pj_stristr(const pj_str_t *str, const pj_str_t *substr) 51 { 52 const char *s, *ends; 53 54 /* Special case when substr is zero */ 55 if (substr->slen == 0) { 56 return (char*)str->ptr; 57 } 58 59 s = str->ptr; 60 ends = str->ptr + str->slen - substr->slen; 61 for (; s<=ends; ++s) { 62 if (pj_ansi_strnicmp(s, substr->ptr, substr->slen)==0) 63 return (char*)s; 64 } 65 return NULL; 66 } 29 67 30 68
Note: See TracChangeset
for help on using the changeset viewer.