X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcstrutil.c;h=1655f213459470ab4a4765d0d55a12b9ba7c9440;hb=51558729d89b9f3492b2ca754242ed548a579ca4;hp=e7344ad5b9d76fa5e3b351b570544bd17bc44ebf;hpb=1c3ae0efc13419718213114e140c3d83b4608c1e;p=runtime.git diff --git a/lib/silcutil/silcstrutil.c b/lib/silcutil/silcstrutil.c index e7344ad5..1655f213 100644 --- a/lib/silcutil/silcstrutil.c +++ b/lib/silcutil/silcstrutil.c @@ -124,10 +124,10 @@ char **silc_string_split(const char *string, char ch, int *ret_count) char **splitted = NULL, sep[1], *item, *cp; int i = 0, len; - if (!string) - return NULL; - if (!ret_count) + if (!string || !ret_count) { + silc_set_errno(SILC_ERR_INVALID_ARGUMENT); return NULL; + } splitted = silc_calloc(1, sizeof(*splitted)); if (!splitted) @@ -174,8 +174,10 @@ char *silc_string_regexify(const char *string) int i, len, count; char *regex; - if (!string) + if (!string) { + silc_set_errno(SILC_ERR_INVALID_ARGUMENT); return NULL; + } len = strlen(string); count = 4; @@ -224,8 +226,10 @@ char *silc_string_regex_combine(const char *string1, const char *string2) char *tmp; int len1, len2; - if (!string1 || !string2) + if (!string1 || !string2) { + silc_set_errno(SILC_ERR_INVALID_ARGUMENT); return NULL; + } len1 = strlen(string1); len2 = strlen(string2); @@ -245,8 +249,10 @@ int silc_string_regex_match(const char *regex, const char *string) regex_t preg; int ret = FALSE; - if (regcomp(&preg, regex, REG_NOSUB | REG_EXTENDED) != 0) + if (regcomp(&preg, regex, REG_NOSUB | REG_EXTENDED) != 0) { + silc_set_errno(SILC_ERR_INVALID_ARGUMENT); return FALSE; + } if (regexec(&preg, string, 0, NULL, 0) == 0) ret = TRUE; @@ -264,8 +270,10 @@ int silc_string_match(const char *string1, const char *string2) char *s1; int ret = FALSE; - if (!string1 || !string2) + if (!string1 || !string2) { + silc_set_errno(SILC_ERR_INVALID_ARGUMENT); return ret; + } s1 = silc_string_regexify(string1); ret = silc_string_regex_match(s1, string2);