blob: 1d44f3de55529cf8094b82027a3c8aef2052ddd6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include "project.h"
ICACHE_FLASH_ATTR char *
bounded_strstr (char *haystack, uint32_t len, char *needle)
{
char *end = haystack + len;
char *hptr, *nptr;
if (!*needle)
return NULL;
for (; (*haystack) && (haystack < end); ++haystack)
{
hptr = haystack;
nptr = needle;
while ((*hptr) == (*nptr))
{
nptr++;
hptr++;
if (!*nptr)
return haystack;
if (hptr >= end)
return NULL;
}
}
return NULL;
}
bool
util_isspace (char c)
{
switch (c)
{
case ' ':
case '\r':
case '\t':
case '\n':
return true;
default:
return false;
}
}
ICACHE_FLASH_ATTR void
crash (void)
{
char *c = NULL;
os_printf ("%d", *c);
}
|