diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2005-12-01 20:43:44 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2005-12-01 20:43:44 +0000 |
commit | 8a0b43005ad9ea011b80d66e32b46fb430ddaffb (patch) | |
tree | 418818740042c5dbba244bc1efc760c8d29e47a9 /libc/stdlib | |
parent | 42b161bb716f35948fabd36472fb59cd0a20fa92 (diff) |
Hide mostly used functions
Diffstat (limited to 'libc/stdlib')
-rw-r--r-- | libc/stdlib/abort.c | 4 | ||||
-rw-r--r-- | libc/stdlib/bsd_getpt.c | 6 | ||||
-rw-r--r-- | libc/stdlib/getenv.c | 4 | ||||
-rw-r--r-- | libc/stdlib/getpt.c | 4 | ||||
-rw-r--r-- | libc/stdlib/malloc-simple/alloc.c | 4 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/calloc.c | 4 | ||||
-rw-r--r-- | libc/stdlib/malloc-standard/realloc.c | 4 | ||||
-rw-r--r-- | libc/stdlib/malloc/calloc.c | 2 | ||||
-rw-r--r-- | libc/stdlib/malloc/realloc.c | 2 | ||||
-rw-r--r-- | libc/stdlib/ptsname.c | 12 | ||||
-rw-r--r-- | libc/stdlib/realpath.c | 16 | ||||
-rw-r--r-- | libc/stdlib/seed48_r.c | 4 | ||||
-rw-r--r-- | libc/stdlib/setenv.c | 24 | ||||
-rw-r--r-- | libc/stdlib/strtod.c | 2 | ||||
-rw-r--r-- | libc/stdlib/unix_grantpt.c | 1 |
15 files changed, 46 insertions, 47 deletions
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 6457836e8..07e4a208c 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -92,7 +92,7 @@ void abort(void) /* Unmask SIGABRT to be sure we can get it */ if (__sigemptyset(&sigset) == 0 && __sigaddset(&sigset, SIGABRT) == 0) { - sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); + __sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); } while (1) { @@ -121,7 +121,7 @@ abort_it: struct sigaction act; been_there_done_that++; - memset(&act, '\0', sizeof(struct sigaction)); + __memset(&act, '\0', sizeof(struct sigaction)); act.sa_handler = SIG_DFL; __sigfillset(&act.sa_mask); act.sa_flags = 0; diff --git a/libc/stdlib/bsd_getpt.c b/libc/stdlib/bsd_getpt.c index 0249abbde..f219afd29 100644 --- a/libc/stdlib/bsd_getpt.c +++ b/libc/stdlib/bsd_getpt.c @@ -48,8 +48,8 @@ __getpt (void) const char *p, *q; char *s; - memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY)); - s = buf + strlen (buf); + __memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY)); + s = buf + __strlen (buf); /* s[0] and s[1] will be filled in the loop. */ s[2] = '\0'; @@ -64,7 +64,7 @@ __getpt (void) s[1] = *q; - fd = open (buf, O_RDWR); + fd = __open (buf, O_RDWR); if (fd != -1) return fd; diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c index 2daf03955..9dfc0d132 100644 --- a/libc/stdlib/getenv.c +++ b/libc/stdlib/getenv.c @@ -29,9 +29,9 @@ char *getenv(const char *var) if (!(ep=__environ)) return NULL; - len = strlen(var); + len = __strlen(var); while(*ep) { - if (memcmp(var, *ep, len) == 0 && (*ep)[len] == '=') { + if (__memcmp(var, *ep, len) == 0 && (*ep)[len] == '=') { return *ep + len + 1; } ep++; diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c index 71d7d6c5f..c219adb24 100644 --- a/libc/stdlib/getpt.c +++ b/libc/stdlib/getpt.c @@ -55,7 +55,7 @@ getpt (void) if (!have_no_dev_ptmx) #endif { - fd = open (_PATH_DEVPTMX, O_RDWR); + fd = __open (_PATH_DEVPTMX, O_RDWR); if (fd != -1) { #if defined __ASSUME_DEVPTS__ @@ -79,7 +79,7 @@ getpt (void) /* If /dev/pts is not mounted then the UNIX98 pseudo terminals are not usable. */ - close (fd); + __close (fd); #if !defined __UNIX98PTY_ONLY__ have_no_dev_ptmx = 1; #endif diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index ed14c37c4..7f0a91f0b 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -64,7 +64,7 @@ void * calloc(size_t nmemb, size_t lsize) * doesn't need to actually zero anything.... */ if (result != NULL) { - memset(result, 0, size); + __memset(result, 0, size); } #endif return result; @@ -85,7 +85,7 @@ void *realloc(void *ptr, size_t size) newptr = malloc(size); if (newptr) { - memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t)))); + __memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t)))); free(ptr); } return newptr; diff --git a/libc/stdlib/malloc-standard/calloc.c b/libc/stdlib/malloc-standard/calloc.c index a67dad738..b8c43d9dc 100644 --- a/libc/stdlib/malloc-standard/calloc.c +++ b/libc/stdlib/malloc-standard/calloc.c @@ -54,7 +54,7 @@ void* calloc(size_t n_elements, size_t elem_size) assert(nclears >= 3); if (nclears > 9) - memset(d, 0, clearsize); + __memset(d, 0, clearsize); else { *(d+0) = 0; @@ -83,7 +83,7 @@ void* calloc(size_t n_elements, size_t elem_size) d = (size_t*)mem; /* Note the additional (sizeof(size_t)) */ clearsize = chunksize(p) - 2*(sizeof(size_t)); - memset(d, 0, clearsize); + __memset(d, 0, clearsize); } #endif } diff --git a/libc/stdlib/malloc-standard/realloc.c b/libc/stdlib/malloc-standard/realloc.c index 195013095..3d77442af 100644 --- a/libc/stdlib/malloc-standard/realloc.c +++ b/libc/stdlib/malloc-standard/realloc.c @@ -126,7 +126,7 @@ void* realloc(void* oldmem, size_t bytes) assert(ncopies >= 3); if (ncopies > 9) - memcpy(d, s, copysize); + __memcpy(d, s, copysize); else { *(d+0) = *(s+0); @@ -226,7 +226,7 @@ void* realloc(void* oldmem, size_t bytes) /* Must alloc, copy, free. */ newmem = malloc(nb - MALLOC_ALIGN_MASK); if (newmem != 0) { - memcpy(newmem, oldmem, oldsize - 2*(sizeof(size_t))); + __memcpy(newmem, oldmem, oldsize - 2*(sizeof(size_t))); free(oldmem); } } diff --git a/libc/stdlib/malloc/calloc.c b/libc/stdlib/malloc/calloc.c index 15281a97f..94031ce29 100644 --- a/libc/stdlib/malloc/calloc.c +++ b/libc/stdlib/malloc/calloc.c @@ -34,7 +34,7 @@ void * calloc(size_t nmemb, size_t lsize) return NULL; } if ((result=malloc(size)) != NULL) { - memset(result, 0, size); + __memset(result, 0, size); } return result; } diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index 85392ae6a..8dcc35360 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -66,7 +66,7 @@ realloc (void *mem, size_t new_size) void *new_mem = malloc (new_size - MALLOC_HEADER_SIZE); if (new_mem) { - memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE); + __memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE); free (mem); } mem = new_mem; diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 4ed70427e..539cbcae2 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -103,8 +103,8 @@ int ptsname_r (int fd, char *buf, size_t buflen) return ERANGE; } - strcpy (buf, devpts); - strcat (buf, p); + __strcpy (buf, devpts); + __strcat (buf, p); /* Note: Don't bother with stat on the slave name and checking the driver's major device number - the ioctl above succeeded so we know the fd was a Unix'98 master and the /dev/pts/ prefix @@ -130,7 +130,7 @@ int ptsname_r (int fd, char *buf, size_t buflen) { char *p; - if (buflen < strlen (_PATH_TTY) + 3) + if (buflen < __strlen (_PATH_TTY) + 3) { errno = ERANGE; return ERANGE; @@ -152,14 +152,14 @@ int ptsname_r (int fd, char *buf, size_t buflen) if (major (st.st_rdev) == 4) ptyno -= 128; - if (ptyno / 16 >= strlen (_ptyname1)) + if (ptyno / 16 >= __strlen (_ptyname1)) { errno = ENOTTY; return ENOTTY; } - strcpy (buf, _PATH_TTY); - p = buf + strlen (buf); + __strcpy (buf, _PATH_TTY); + p = buf + __strlen (buf); p[0] = _ptyname1[ptyno / 16]; p[1] = _ptyname2[ptyno % 16]; p[2] = '\0'; diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c index c3628b745..7266ba4c6 100644 --- a/libc/stdlib/realpath.c +++ b/libc/stdlib/realpath.c @@ -59,11 +59,11 @@ char resolved_path[]; int n; /* Make a copy of the source path since we may need to modify it. */ - if (strlen(path) >= PATH_MAX - 2) { + if (__strlen(path) >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); return NULL; } - strcpy(copy_path, path); + __strcpy(copy_path, path); path = copy_path; max_path = copy_path + PATH_MAX - 2; /* If it's a relative pathname use getwd for starters. */ @@ -75,7 +75,7 @@ char resolved_path[]; #else getwd(new_path); #endif - new_path += strlen(new_path); + new_path += __strlen(new_path); if (new_path[-1] != '/') *new_path++ = '/'; } else { @@ -129,7 +129,7 @@ char resolved_path[]; if (errno != EINVAL) { /* Make sure it's null terminated. */ *new_path = '\0'; - strcpy(resolved_path, got_path); + __strcpy(resolved_path, got_path); return NULL; } } else { @@ -142,13 +142,13 @@ char resolved_path[]; /* Otherwise back up over this component. */ while (*(--new_path) != '/'); /* Safe sex check. */ - if (strlen(path) + n >= PATH_MAX - 2) { + if (__strlen(path) + n >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); return NULL; } /* Insert symlink contents into path. */ - strcat(link_path, path); - strcpy(copy_path, link_path); + __strcat(link_path, path); + __strcpy(copy_path, link_path); path = copy_path; } #endif /* S_IFLNK */ @@ -159,6 +159,6 @@ char resolved_path[]; new_path--; /* Make sure it's null terminated. */ *new_path = '\0'; - strcpy(resolved_path, got_path); + __strcpy(resolved_path, got_path); return resolved_path; } diff --git a/libc/stdlib/seed48_r.c b/libc/stdlib/seed48_r.c index 0bfe11f43..d1c74f24c 100644 --- a/libc/stdlib/seed48_r.c +++ b/libc/stdlib/seed48_r.c @@ -17,8 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define memcpy __memcpy - #include <stdlib.h> #include <string.h> #include <limits.h> @@ -26,7 +24,7 @@ int attribute_hidden __seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer) { /* Save old value at a private place to be used as return value. */ - memcpy (buffer->__old_x, buffer->__x, sizeof (buffer->__x)); + __memcpy (buffer->__old_x, buffer->__x, sizeof (buffer->__x)); /* Install new state. */ buffer->__x[2] = seed16v[2]; diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index 5df8b0d98..8704717a7 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -56,8 +56,8 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, { register char **ep; register size_t size; - const size_t namelen = strlen (name); - const size_t vallen = value != NULL ? strlen (value) + 1 : 0; + const size_t namelen = __strlen (name); + const size_t vallen = value != NULL ? __strlen (value) + 1 : 0; LOCK; @@ -68,7 +68,7 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, size = 0; if (ep != NULL) { for (; *ep != NULL; ++ep) { - if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') + if (!__strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') break; else ++size; @@ -100,13 +100,13 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, return -1; } - memcpy (new_environ[size], name, namelen); + __memcpy (new_environ[size], name, namelen); new_environ[size][namelen] = '='; - memcpy (&new_environ[size][namelen + 1], value, vallen); + __memcpy (&new_environ[size][namelen + 1], value, vallen); } if (__environ != last_environ) { - memcpy ((char *) new_environ, (char *) __environ, + __memcpy ((char *) new_environ, (char *) __environ, size * sizeof (char *)); } @@ -124,9 +124,9 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, UNLOCK; return -1; } - memcpy (np, name, namelen); + __memcpy (np, name, namelen); np[namelen] = '='; - memcpy (&np[namelen + 1], value, vallen); + __memcpy (&np[namelen + 1], value, vallen); } *ep = np; } @@ -145,16 +145,16 @@ int attribute_hidden __unsetenv (const char *name) size_t len; char **ep; - if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { + if (name == NULL || *name == '\0' || __strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } - len = strlen (name); + len = __strlen (name); LOCK; ep = __environ; while (*ep != NULL) { - if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { + if (!__strncmp (*ep, name, len) && (*ep)[len] == '=') { /* Found it. Remove this pointer by moving later ones back. */ char **dp = ep; do { @@ -191,7 +191,7 @@ int clearenv (void) int putenv (char *string) { int result; - const char *const name_end = strchr (string, '='); + const char *const name_end = __strchr (string, '='); if (name_end != NULL) { char *name = strndup(string, name_end - string); diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c index 10844414e..47f809f3e 100644 --- a/libc/stdlib/strtod.c +++ b/libc/stdlib/strtod.c @@ -314,7 +314,7 @@ __fpmax_t __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endptr, int exponent_ goto LOOP; } #else - if (!pos0 && !memcmp(pos, decpt, decpt_len)) { /* First decimal point? */ + if (!pos0 && !__memcmp(pos, decpt, decpt_len)) { /* First decimal point? */ pos0 = (pos += decpt_len); goto LOOP; } diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index 181fab37f..5d21ec9f8 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -19,6 +19,7 @@ #define memchr __memchr #define getgid __getgid +#define setrlimit __setrlimit #include <assert.h> #include <errno.h> |