summaryrefslogtreecommitdiffstats
path: root/src/include/string.h
diff options
context:
space:
mode:
authorMichael Brown2006-11-28 00:50:24 +0100
committerMichael Brown2006-11-28 00:50:24 +0100
commit82342e0b8f34285c02ea5915ff1b74bc9a915efc (patch)
tree17ac3698306746c86472989e22ac582696e16ec0 /src/include/string.h
parentImplemented realloc(), and changed the semantics of malloc(0) to allow (diff)
downloadipxe-82342e0b8f34285c02ea5915ff1b74bc9a915efc.tar.gz
ipxe-82342e0b8f34285c02ea5915ff1b74bc9a915efc.tar.xz
ipxe-82342e0b8f34285c02ea5915ff1b74bc9a915efc.zip
Marked memcmp/strcmp as "pure" functions, to allow gcc to optimise
away code such as if ( strcmp ( some_string, "some_value" ) != 0 ) { DBG ( "Bad value received!" ); }
Diffstat (limited to 'src/include/string.h')
-rw-r--r--src/include/string.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/include/string.h b/src/include/string.h
index eea817d8..8ada05a0 100644
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -47,8 +47,9 @@ char * strcpy(char * dest,const char *src);
char * strncpy(char * dest,const char *src,size_t count);
char * strcat(char * dest, const char * src);
char * strncat(char *dest, const char *src, size_t count);
-int strcmp(const char * cs,const char * ct);
-int strncmp(const char * cs,const char * ct,size_t count);
+int __attribute__ (( pure )) strcmp(const char * cs,const char * ct);
+int __attribute__ (( pure )) strncmp(const char * cs,const char * ct,
+ size_t count);
char * strchr(const char * s, int c);
char * strrchr(const char * s, int c);
size_t strlen(const char * s);
@@ -60,7 +61,8 @@ char * strsep(char **s, const char *ct);
void * memset(void * s,int c,size_t count);
char * bcopy(const char * src, char * dest, int count);
void * memmove(void * dest,const void *src,size_t count);
-int memcmp(const void * cs,const void * ct,size_t count);
+int __attribute__ (( pure )) memcmp(const void * cs,const void * ct,
+ size_t count);
void * memscan(void * addr, int c, size_t size);
char * strstr(const char * s1,const char * s2);
void * memchr(const void *s, int c, size_t n);