diff options
-rw-r--r-- | block.c | 2 | ||||
-rw-r--r-- | bsd-user/uaccess.c | 11 | ||||
-rw-r--r-- | cutils.c | 13 | ||||
-rw-r--r-- | linux-user/uaccess.c | 11 | ||||
-rw-r--r-- | qemu-common.h | 1 |
5 files changed, 15 insertions, 23 deletions
@@ -225,7 +225,7 @@ static BlockDriver *find_protocol(const char *filename) { BlockDriver *drv1; char protocol[128]; - int len = strnlen(filename, 127)+1; + int len = qemu_strnlen(filename, 127) + 1; const char *p; #ifdef _WIN32 diff --git a/bsd-user/uaccess.c b/bsd-user/uaccess.c index cc51449b47..9ec1b23437 100644 --- a/bsd-user/uaccess.c +++ b/bsd-user/uaccess.c @@ -37,17 +37,6 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len) return ret; } -/* XXX: use host strnlen if available ? */ -static int qemu_strnlen(const char *s, int max_len) -{ - int i; - for(i = 0; i < max_len; i++) { - if (s[i] == '\0') - break; - } - return i; -} - /* Return the length of a string in target memory or -TARGET_EFAULT if access error */ abi_long target_strlen(abi_ulong guest_addr1) @@ -109,6 +109,19 @@ int stristart(const char *str, const char *val, const char **ptr) return 1; } +/* XXX: use host strnlen if available ? */ +int qemu_strnlen(const char *s, int max_len) +{ + int i; + + for(i = 0; i < max_len; i++) { + if (s[i] == '\0') { + break; + } + } + return i; +} + time_t mktimegm(struct tm *tm) { time_t t; diff --git a/linux-user/uaccess.c b/linux-user/uaccess.c index 4d506935f8..a4d108c2f7 100644 --- a/linux-user/uaccess.c +++ b/linux-user/uaccess.c @@ -37,17 +37,6 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len) return ret; } -/* XXX: use host strnlen if available ? */ -static int qemu_strnlen(const char *s, int max_len) -{ - int i; - for(i = 0; i < max_len; i++) { - if (s[i] == '\0') - break; - } - return i; -} - /* Return the length of a string in target memory or -TARGET_EFAULT if access error */ abi_long target_strlen(abi_ulong guest_addr1) diff --git a/qemu-common.h b/qemu-common.h index 5b8ac77f09..a5d8fffb75 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -109,6 +109,7 @@ void pstrcpy(char *buf, int buf_size, const char *str); char *pstrcat(char *buf, int buf_size, const char *s); int strstart(const char *str, const char *val, const char **ptr); int stristart(const char *str, const char *val, const char **ptr); +int qemu_strnlen(const char *s, int max_len); time_t mktimegm(struct tm *tm); int qemu_fls(int i); |