Skip to content

Commit 9b45feb

Browse files
authored
Revert "remove memrchr"
1 parent fc9f6dc commit 9b45feb

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

module/wn_module_upload.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#include <wn_module.h>
2626
#include <wn_utils.h>
2727

28-
#include <strings.h>
29-
3028
#ifdef RT_USING_DFS
3129
#include <dfs_posix.h>
3230
#endif
@@ -161,6 +159,27 @@ static char* memstrs(const char* str, size_t length, int num, ...)
161159
return ptr;
162160
}
163161

162+
#if !(defined(__GNUC__) && !defined(__ARMCC_VERSION)/*GCC*/)
163+
static void* memrchr(const void *s, int c, size_t n)
164+
{
165+
register const char* t=s;
166+
register const char* last=0;
167+
int i;
168+
169+
t = t + n;
170+
for (i=n; i; --i)
171+
{
172+
if (*t==c)
173+
{
174+
last=t;
175+
break;
176+
}
177+
t--;
178+
}
179+
return (void*)last; /* man, what an utterly b0rken prototype */
180+
}
181+
#endif
182+
164183
static char* _webnet_module_upload_parse_header(struct webnet_session* session, char* buffer, rt_size_t length)
165184
{
166185
char *ptr, *ch, *end_ptr;

0 commit comments

Comments
 (0)