aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/string/strchr.c2
-rw-r--r--src/wchar/wcschr.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/string/strchr.c b/src/string/strchr.c
index e046ea7..bf79a0b 100644
--- a/src/string/strchr.c
+++ b/src/string/strchr.c
@@ -151,6 +151,6 @@ char* strrchr(const char* string, int c)
if (*string == c)
r = string;
else if (!*string++)
- return r;
+ return c ? r : (string - 1);
}
diff --git a/src/wchar/wcschr.c b/src/wchar/wcschr.c
index 16ecac2..9b87167 100644
--- a/src/wchar/wcschr.c
+++ b/src/wchar/wcschr.c
@@ -151,6 +151,6 @@ wchar_t* wcsrchr(const wchar_t* string, wchar_t c)
if (*string == c)
r = string;
else if (!*string++)
- return r;
+ return c ? r : (string - 1);
}