projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement ast2firm part of the GNU "a ?: b" extension.
[cparser]
/
builtins
/
builtins.c
diff --git
a/builtins/builtins.c
b/builtins/builtins.c
index
6cab6aa
..
9b20ce9
100644
(file)
--- a/
builtins/builtins.c
+++ b/
builtins/builtins.c
@@
-1,9
+1,9
@@
static inline char *strchr(const char *s, int c)
{
static inline char *strchr(const char *s, int c)
{
-
for ( ; *s != 0; ++s)
{
+
do
{
if (*s == c)
return (char*) s;
if (*s == c)
return (char*) s;
- }
+ }
while (*s++ != '\0');
return (char*) 0;
}
return (char*) 0;
}
@@
-11,10
+11,10
@@
static inline char *strrchr(const char *s, int c)
{
const char *result = (const char*) 0;
{
const char *result = (const char*) 0;
-
for ( ; *s != 0; ++s)
{
+
do
{
if (*s == c)
result = s;
if (*s == c)
result = s;
- }
+ }
while (*s++ != '\0');
return (char*) result;
}
return (char*) result;
}
@@
-24,7
+24,7
@@
static inline int strcmp(const char *s1, const char *s2)
if(*s1 != *s2)
break;
}
if(*s1 != *s2)
break;
}
- return
*s1 -
*s2;
+ return
(unsigned char)*s1 - (unsigned char)
*s2;
}
static inline __SIZE_TYPE__ strlen(const char *s)
}
static inline __SIZE_TYPE__ strlen(const char *s)
@@
-34,3
+34,10
@@
static inline __SIZE_TYPE__ strlen(const char *s)
result++;
return result;
}
result++;
return result;
}
+
+static inline char *strcpy(char *dest, const char *source)
+{
+ char *d = dest;
+ while ((*d++ = *source++) != '\0') {}
+ return dest;
+}