fix stringUtils to complain with tests
@@ -112,7 +112,8 @@ char* getDateString() {
* eliminates a character c if it is followed by character f
*/
char* strelimIfFollowed(char* str, char c, char f) {
- if (!strValid(str)) {
+ if (str == NULL) {
+ oidc_setArgNullFuncError(__func__);
return str;
}
size_t len = strlen(str);
@@ -132,7 +133,8 @@ char* strelimIfFollowed(char* str, char c, char f) {
* eliminates a character c if it the previous character is f
*/
char* strelimIfAfter(char* str, char c, char f) {
- if (!strValid(str)) {
+ if (str == NULL) {
+ oidc_setArgNullFuncError(__func__);
return str;
}
size_t len = strlen(str);
@@ -149,6 +151,7 @@ char* strelimIfAfter(char* str, char c, char f) {
}
char* strelim(char str[], char c) {
if (str == NULL) {
+ oidc_setArgNullFuncError(__func__);
return NULL;
}
size_t len = strlen(str);
@@ -164,6 +167,10 @@ char* strelim(char str[], char c) {
}
size_t strCountChar(const char* s, char c) {
+ if (s == NULL) {
+ oidc_setArgNullFuncError(__func__);
+ return 0;
+ }
int i;
for (i = 0; s[i]; s[i] == c ? i++ : *s++)
;
@@ -178,6 +185,7 @@ int strcaseequal(const char* a, const char* b) {
char* escapeCharInStr(const char* str, char c) {
if (str == NULL) {
+ oidc_setArgNullFuncError(__func__);
return NULL;
}
char* s = oidc_strcopy(str);
@@ -207,6 +215,7 @@ int strSubStringCase(const char* h, const char* n) {
int strToInt(const char* str) {
if (str == NULL) {
+ oidc_setArgNullFuncError(__func__);
return 0;
}
int i;
@@ -216,6 +225,7 @@ int strToInt(const char* str) {
unsigned long strToULong(const char* str) {
if (str == NULL) {
+ oidc_setArgNullFuncError(__func__);
return 0;
}
unsigned long l;
