summaryrefslogtreecommitdiffstats
path: root/polycom_xmit/util.c
diff options
context:
space:
mode:
authorroot <root@lamia.panaceas.james.local>2015-07-21 08:33:53 +0100
committerroot <root@lamia.panaceas.james.local>2015-07-21 08:33:53 +0100
commit0a8e1c08e10d53f58d9e67d5bca09b8ae6a16c39 (patch)
tree1a78099f912d094c7793e15ff9de75d1fc9d1253 /polycom_xmit/util.c
downloadpolycom-0a8e1c08e10d53f58d9e67d5bca09b8ae6a16c39.tar.gz
polycom-0a8e1c08e10d53f58d9e67d5bca09b8ae6a16c39.tar.bz2
polycom-0a8e1c08e10d53f58d9e67d5bca09b8ae6a16c39.zip
fish
Diffstat (limited to 'polycom_xmit/util.c')
-rw-r--r--polycom_xmit/util.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/polycom_xmit/util.c b/polycom_xmit/util.c
new file mode 100644
index 0000000..d637174
--- /dev/null
+++ b/polycom_xmit/util.c
@@ -0,0 +1,47 @@
+#include "project.h"
+
+
+char *ICACHE_FLASH_ATTR
+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;
+ }
+}