diff options
Diffstat (limited to 'libc')
-rw-r--r-- | libc/misc/time/time.c | 43 | ||||
-rw-r--r-- | libc/string/generic/memchr.c | 4 | ||||
-rw-r--r-- | libc/string/generic/mempcpy.c | 3 | ||||
-rw-r--r-- | libc/string/sparc/sparc64/memchr.S | 2 | ||||
-rw-r--r-- | libc/string/stpcpy.c | 2 |
5 files changed, 27 insertions, 27 deletions
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index ae800e1ca..45ec131b7 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -618,43 +618,48 @@ libc_hidden_def(localtime_r) #ifdef __UCLIBC_HAS_TM_EXTENSIONS__ -/* Experimentally off - libc_hidden_proto(strnlen) */ - struct ll_tzname_item; typedef struct ll_tzname_item { struct ll_tzname_item *next; - char tzname[TZNAME_MAX+1]; + char tzname[1]; } ll_tzname_item_t; -static ll_tzname_item_t ll_tzname[] = { - { ll_tzname + 1, "UTC" }, /* Always 1st. */ - { NULL, "???" } /* Always 2nd. (invalid or out-of-memory) */ -}; +/* Structures form a list "UTC" -> "???" -> "tzname1" -> "tzname2"... */ +struct { + struct ll_tzname_item *next; + char tzname[4]; +} ll_tzname_UNKNOWN = { NULL, "???" }; +const struct { + struct ll_tzname_item *next; + char tzname[4]; +} ll_tzname_UTC = { (void*)&ll_tzname_UNKNOWN, "UTC" }; static const char *lookup_tzname(const char *key) { - ll_tzname_item_t *p; + int len; + ll_tzname_item_t *p = (void*) &ll_tzname_UTC; - for (p=ll_tzname ; p ; p=p->next) { - if (!strcmp(p->tzname, key)) { + do { + if (strcmp(p->tzname, key) == 0) return p->tzname; - } - } + p = p->next; + } while (p != NULL); /* Hmm... a new name. */ - if (strnlen(key, TZNAME_MAX+1) < TZNAME_MAX+1) { /* Verify legal length */ - if ((p = malloc(sizeof(ll_tzname_item_t))) != NULL) { + len = strnlen(key, TZNAME_MAX+1); + if (len < TZNAME_MAX+1) { /* Verify legal length */ + p = malloc(sizeof(ll_tzname_item_t) + len); + if (p != NULL) { /* Insert as 3rd item in the list. */ - p->next = ll_tzname[1].next; - ll_tzname[1].next = p; - strcpy(p->tzname, key); - return p->tzname; + p->next = ll_tzname_UNKNOWN.next; + ll_tzname_UNKNOWN.next = p; + return strcpy(p->tzname, key); } } /* Either invalid or couldn't alloc. */ - return ll_tzname[1].tzname; + return ll_tzname_UNKNOWN.tzname; } #endif /* __UCLIBC_HAS_TM_EXTENSIONS__ */ diff --git a/libc/string/generic/memchr.c b/libc/string/generic/memchr.c index 8ea3f539a..d5cd0005e 100644 --- a/libc/string/generic/memchr.c +++ b/libc/string/generic/memchr.c @@ -25,14 +25,12 @@ #include <stdlib.h> #include <limits.h> -/* Experimentally off - libc_hidden_proto(memchr) */ -/* libc_hidden_proto(abort) */ - #include "memcopy.h" #define LONG_MAX_32_BITS 2147483647 /* Search no more than N bytes of S for C. */ +#undef memchr void *memchr (const void * s, int c_in, size_t n) { const unsigned char *char_ptr; diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index 0fcdb665c..d7fa79ef5 100644 --- a/libc/string/generic/mempcpy.c +++ b/libc/string/generic/mempcpy.c @@ -9,12 +9,11 @@ #ifdef __USE_GNU -#undef mempcpy +# undef mempcpy void *mempcpy (void *dstpp, const void *srcpp, size_t len) { memcpy(dstpp, srcpp, len); return (void *)(((char *)dstpp) + len); } libc_hidden_weak(mempcpy) - #endif diff --git a/libc/string/sparc/sparc64/memchr.S b/libc/string/sparc/sparc64/memchr.S index 6096cc218..f44850b08 100644 --- a/libc/string/sparc/sparc64/memchr.S +++ b/libc/string/sparc/sparc64/memchr.S @@ -256,6 +256,4 @@ ENTRY(memchr) END(memchr) libc_hidden_def(memchr) -#if !__BOUNDED_POINTERS__ weak_alias(memchr,__ubp_memchr) -#endif diff --git a/libc/string/stpcpy.c b/libc/string/stpcpy.c index 8a487584e..58ace8fc7 100644 --- a/libc/string/stpcpy.c +++ b/libc/string/stpcpy.c @@ -10,7 +10,7 @@ #ifdef WANT_WIDE # define Wstpcpy wcpcpy #else -/* Experimentally off - libc_hidden_proto(stpcpy) */ +# undef stpcpy # define Wstpcpy stpcpy #endif |