aboutsummaryrefslogtreecommitdiff
path: root/backends/PalmOS
diff options
context:
space:
mode:
authorChris Apers2004-05-25 13:38:36 +0000
committerChris Apers2004-05-25 13:38:36 +0000
commit2fd3e0ed8062f3b5748e5cbafbd5d3435fe725a0 (patch)
tree57715d9a033279efe2888f3a6eae1fa60b745375 /backends/PalmOS
parente228f9b55d66e491e35c28ebc71a0cf8a2e50c72 (diff)
downloadscummvm-rg350-2fd3e0ed8062f3b5748e5cbafbd5d3435fe725a0.tar.gz
scummvm-rg350-2fd3e0ed8062f3b5748e5cbafbd5d3435fe725a0.tar.bz2
scummvm-rg350-2fd3e0ed8062f3b5748e5cbafbd5d3435fe725a0.zip
Cleanup, new strspn function
svn-id: r13869
Diffstat (limited to 'backends/PalmOS')
-rw-r--r--backends/PalmOS/Src/missing/_string.cpp29
-rw-r--r--backends/PalmOS/Src/missing/string.h11
2 files changed, 24 insertions, 16 deletions
diff --git a/backends/PalmOS/Src/missing/_string.cpp b/backends/PalmOS/Src/missing/_string.cpp
index 0b7b3720a0..191185dddf 100644
--- a/backends/PalmOS/Src/missing/_string.cpp
+++ b/backends/PalmOS/Src/missing/_string.cpp
@@ -21,7 +21,7 @@
*/
#include "string.h"
-///////////////////////////////////////////////////////////////////////////////
+
void *memchr(const void *s, int c, UInt32 n) {
UInt32 chr;
for(chr = 0; chr < n;chr++,((UInt8 *)s)++)
@@ -29,9 +29,20 @@ void *memchr(const void *s, int c, UInt32 n) {
return (void *)s;
return NULL;
-}
-///////////////////////////////////////////////////////////////////////////////
-Char *StrTokNext;
+}
+
+UInt32 strspn(const char *s1, const char *s2) {
+ UInt32 chr = 0;
+
+ while ( chr < strlen(s1) &&
+ strchr(s2, s1[chr]) )
+ chr++;
+
+ return chr;
+}
+
+static Char *StrTokNext = NULL;
+
Char *strtok(Char *str, const Char *sep) {
Char *position = NULL,
*found,
@@ -73,7 +84,7 @@ Char *strtok(Char *str, const Char *sep) {
return str;
}
-///////////////////////////////////////////////////////////////////////////////
+
Char *strpbrk(const Char *s1, const Char *s2) {
Char *found;
UInt32 n;
@@ -86,7 +97,7 @@ Char *strpbrk(const Char *s1, const Char *s2) {
return NULL;
}
-///////////////////////////////////////////////////////////////////////////////
+
Char *strrchr(const Char *s, int c) {
UInt32 chr;
UInt32 n = StrLen(s);
@@ -97,7 +108,7 @@ Char *strrchr(const Char *s, int c) {
return NULL;
}
-///////////////////////////////////////////////////////////////////////////////
+
Char *strdup(const Char *s1) {
Char* buf = (Char *)MemPtrNew(StrLen(s1)+1);
@@ -106,7 +117,3 @@ Char *strdup(const Char *s1) {
return buf;
}
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
diff --git a/backends/PalmOS/Src/missing/string.h b/backends/PalmOS/Src/missing/string.h
index 1ff04f8180..ecb362c382 100644
--- a/backends/PalmOS/Src/missing/string.h
+++ b/backends/PalmOS/Src/missing/string.h
@@ -38,10 +38,11 @@
#define strncmp StrNCompare
#define strstr StrStr
-void *memchr(const void *s, int c, UInt32 n);
-Char *strtok(Char *str, const Char *sep);
-Char *strrchr(const Char *s, int c);
-Char *strdup(const Char *strSource);
-Char *strpbrk(const Char *s1, const Char *s2);
+void *memchr (const void *s, int c, UInt32 n);
+Char *strtok (Char *str, const Char *sep);
+Char *strrchr (const Char *s, int c);
+Char *strdup (const Char *strSource);
+Char *strpbrk (const Char *s1, const Char *s2);
+UInt32 strspn (const char *s1, const char *s2);
#define StrTok strtok \ No newline at end of file