aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk/memdisk.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-08-20 15:15:34 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-08-20 15:15:34 -0700
commitbd09a6d828fa492aed4406adde6c412e0e5c640d (patch)
tree660a4813999ba273afb26fd3e137399cb0a57a97 /memdisk/memdisk.h
parent6aa3a1c8380276387430684eb39650e958b0030a (diff)
downloadsyslinux.git-bd09a6d828fa492aed4406adde6c412e0e5c640d.tar.gz
syslinux.git-bd09a6d828fa492aed4406adde6c412e0e5c640d.tar.xz
syslinux.git-bd09a6d828fa492aed4406adde6c412e0e5c640d.zip
Major Makefile cleanups; gcc 4.3.0 compatiblity
Cleanup and centralize the Makefile system even more. Fix a gcc 4.3 incompatibility in memdisk (definition of strlen).
Diffstat (limited to 'memdisk/memdisk.h')
-rw-r--r--memdisk/memdisk.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/memdisk/memdisk.h b/memdisk/memdisk.h
index 615e3d1e..9d4a4297 100644
--- a/memdisk/memdisk.h
+++ b/memdisk/memdisk.h
@@ -40,11 +40,22 @@ extern void __attribute__((noreturn)) die(void);
#define memcpy(a,b,c) __builtin_memcpy(a,b,c)
#define memset(a,b,c) __builtin_memset(a,b,c)
#define strcpy(a,b) __builtin_strcpy(a,b)
-#define strlen(a) __builtin_strlen(a)
+
+static inline size_t strlen(const char *__a)
+{
+ const char *__D;
+ size_t __c;
+
+ asm("repne;scasb"
+ : "=D" (__D), "=c" (__c)
+ : "D" (__a), "c" (-1), "a" (0), "m" (*__a));
+
+ return __D - __a - 1;
+}
/* memcpy() but returns a pointer to end of buffer */
static inline void *
-memcpy_endptr(void *__d, const void *__s, unsigned int __n)
+mempcpy(void *__d, const void *__s, unsigned int __n)
{
memcpy(__d, __s, __n);
return (void *)((char *)__d + __n);