X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fos_regex%2Fos_regex_str.c;h=cf2342362a69f5995421c1abf81d814d4261ae1b;hb=927951d1c1ad45ba9e7325f07d996154a91c911b;hp=4b5ddbc6697ef45436b40b27ac5f804ebe4171c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554;p=ossec-hids.git diff --git a/src/os_regex/os_regex_str.c b/src/os_regex/os_regex_str.c index 4b5ddbc..cf23423 100755 --- a/src/os_regex/os_regex_str.c +++ b/src/os_regex/os_regex_str.c @@ -13,22 +13,24 @@ #include #include #include + +#include "os_regex.h" #include "os_regex_internal.h" /** int OS_StrIsNum(char *str) v0.1 * Checks if a specific string is numeric (like "129544") */ -int OS_StrIsNum(char *str) +int OS_StrIsNum(const char *str) { if(str == NULL) return(FALSE); - + while(*str != '\0') { if(!_IsD(*str)) return(FALSE); /* 0 */ - str++; + str++; } return(TRUE); @@ -37,12 +39,12 @@ int OS_StrIsNum(char *str) /** int OS_StrHowClosedMatch(char *str1, char *str2) v0.1 * Returns the number of characters that both strings - * have in similar. + * have in similar. */ -int OS_StrHowClosedMatch(char *str1, char *str2) +size_t OS_StrHowClosedMatch(const char *str1, const char *str2) { - int count = 0; - + size_t count = 0; + /* They don't match if any of them is null */ if(!str1 || !str2) { @@ -58,17 +60,9 @@ int OS_StrHowClosedMatch(char *str1, char *str2) count++; }while((str1[count] != '\0') && (str2[count] != '\0')); - + return(count); } - -/** int OS_StrStartsWith(char *str, char *pattern) v0.1 - * Verifies if a string starts with the provided pattern. - * Returns 1 on success or 0 on failure. - */ -#define startswith(x,y) (strncmp(x,y,strlen(y)) == 0?1:0) -#define OS_StrStartsWith startswith - /* EOF */