summaryrefslogtreecommitdiff
path: root/nuttx/lib/lib_strstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/lib/lib_strstr.c')
-rw-r--r--nuttx/lib/lib_strstr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nuttx/lib/lib_strstr.c b/nuttx/lib/lib_strstr.c
index 3649a6ac8..4e2eeb94c 100644
--- a/nuttx/lib/lib_strstr.c
+++ b/nuttx/lib/lib_strstr.c
@@ -53,7 +53,9 @@ char *strstr(const char *str, const char *substr)
/* Special case the empty substring */
- ch = *substr++;
+ len = strlen(substr);
+ ch = *substr++;
+
if (!ch)
{
/* We'll say that an empty substring matches at the beginning of
@@ -66,8 +68,6 @@ char *strstr(const char *str, const char *substr)
/* Search for the substring */
candidate = str;
- len = strlen(substr);
-
for (;;)
{
/* strchr() will return a pointer to the next occurrence of the