From 8a0b43005ad9ea011b80d66e32b46fb430ddaffb Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 1 Dec 2005 20:43:44 +0000 Subject: Hide mostly used functions --- libc/misc/dirent/alphasort.c | 2 +- libc/misc/dirent/alphasort64.c | 2 +- libc/misc/dirent/closedir.c | 2 +- libc/misc/dirent/opendir.c | 6 +-- libc/misc/dirent/readdir64_r.c | 2 +- libc/misc/dirent/readdir_r.c | 2 +- libc/misc/dirent/scandir.c | 2 +- libc/misc/dirent/scandir64.c | 2 +- libc/misc/error/error.c | 2 +- libc/misc/file/lockf.c | 2 +- libc/misc/file/lockf64.c | 2 +- libc/misc/ftw/ftw.c | 15 ++++--- libc/misc/glob/glob.c | 26 ++++++------- libc/misc/internals/__uClibc_main.c | 6 +-- libc/misc/internals/tempname.c | 22 ++++++----- libc/misc/intl/intl.c | 4 +- libc/misc/locale/locale.c | 52 ++++++++++++------------- libc/misc/regex/regex.c | 9 +++++ libc/misc/regex/regex_old.c | 5 +-- libc/misc/search/hsearch_r.c | 6 +-- libc/misc/search/lsearch.c | 2 +- libc/misc/statfs/fstatfs64.c | 2 +- libc/misc/statfs/internal_statvfs.c | 18 ++++----- libc/misc/statfs/statfs64.c | 2 +- libc/misc/syslog/syslog.c | 32 +++++++-------- libc/misc/time/time.c | 43 ++++++++++---------- libc/misc/ttyent/getttyent.c | 12 +++--- libc/misc/utmp/utent.c | 22 +++++------ libc/misc/utmp/wtent.c | 14 +++---- libc/misc/wchar/wchar.c | 6 +-- libc/misc/wctype/wctype.c | 4 +- libc/misc/wordexp/wordexp.c | 78 ++++++++++++++++++------------------- 32 files changed, 207 insertions(+), 199 deletions(-) (limited to 'libc/misc') diff --git a/libc/misc/dirent/alphasort.c b/libc/misc/dirent/alphasort.c index dcf970070..feae021e6 100644 --- a/libc/misc/dirent/alphasort.c +++ b/libc/misc/dirent/alphasort.c @@ -4,7 +4,7 @@ int alphasort(const void * a, const void * b) { - return strcmp ((*(const struct dirent **) a)->d_name, + return __strcmp ((*(const struct dirent **) a)->d_name, (*(const struct dirent **) b)->d_name); } diff --git a/libc/misc/dirent/alphasort64.c b/libc/misc/dirent/alphasort64.c index bcae8108f..5801f4940 100644 --- a/libc/misc/dirent/alphasort64.c +++ b/libc/misc/dirent/alphasort64.c @@ -19,7 +19,7 @@ int alphasort64(const void * a, const void * b) { - return strcmp ((*(const struct dirent64 **) a)->d_name, + return __strcmp ((*(const struct dirent64 **) a)->d_name, (*(const struct dirent64 **) b)->d_name); } #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c index 068e2d3e2..57600ab69 100644 --- a/libc/misc/dirent/closedir.c +++ b/libc/misc/dirent/closedir.c @@ -29,5 +29,5 @@ int closedir(DIR * dir) #endif free(dir->dd_buf); free(dir); - return close(fd); + return __close(fd); } diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index 017684b40..9f5f75e3f 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -24,7 +24,7 @@ DIR *opendir(const char *name) __set_errno(ENOTDIR); return NULL; } - if ((fd = open(name, O_RDONLY)) < 0) + if ((fd = __open(name, O_RDONLY)) < 0) return NULL; /* According to POSIX, directory streams should be closed when * exec. From "Anna Pluzhnikov" . @@ -32,7 +32,7 @@ DIR *opendir(const char *name) if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) return NULL; if (!(ptr = malloc(sizeof(*ptr)))) { - close(fd); + __close(fd); __set_errno(ENOMEM); return NULL; } @@ -45,7 +45,7 @@ DIR *opendir(const char *name) ptr->dd_max = 512; if (!(buf = calloc(1, ptr->dd_max))) { - close(fd); + __close(fd); free(ptr); __set_errno(ENOMEM); return NULL; diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c index da3564edb..1daae5116 100644 --- a/libc/misc/dirent/readdir64_r.c +++ b/libc/misc/dirent/readdir64_r.c @@ -62,7 +62,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result) if (de == NULL) { *result = NULL; } else { - *result = memcpy (entry, de, de->d_reclen); + *result = __memcpy (entry, de, de->d_reclen); } ret = 0; diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c index 245dcbdde..1c8eeadce 100644 --- a/libc/misc/dirent/readdir_r.c +++ b/libc/misc/dirent/readdir_r.c @@ -48,7 +48,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result) if (de == NULL) { *result = NULL; } else { - *result = memcpy (entry, de, de->d_reclen); + *result = __memcpy (entry, de, de->d_reclen); } ret = 0; diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c index cb3d505db..8b08e4884 100644 --- a/libc/misc/dirent/scandir.c +++ b/libc/misc/dirent/scandir.c @@ -72,7 +72,7 @@ int scandir(const char *dir, struct dirent ***namelist, if (vnew == NULL) break; - names[pos++] = (struct dirent *) memcpy (vnew, current, dsize); + names[pos++] = (struct dirent *) __memcpy (vnew, current, dsize); } if (unlikely(errno != 0)) diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c index b4cc57a36..2916285eb 100644 --- a/libc/misc/dirent/scandir64.c +++ b/libc/misc/dirent/scandir64.c @@ -87,7 +87,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist, if (vnew == NULL) break; - names[pos++] = (struct dirent64 *) memcpy (vnew, current, dsize); + names[pos++] = (struct dirent64 *) __memcpy (vnew, current, dsize); } if (unlikely(errno != 0)) diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index 576d11154..0a19e3923 100644 --- a/libc/misc/error/error.c +++ b/libc/misc/error/error.c @@ -70,7 +70,7 @@ void __error_at_line (int status, int errnum, const char *file_name, static unsigned int old_line_number; if (old_line_number == line_number && - (file_name == old_file_name || !strcmp (old_file_name, file_name))) + (file_name == old_file_name || !__strcmp (old_file_name, file_name))) /* Simply return and print nothing. */ return; diff --git a/libc/misc/file/lockf.c b/libc/misc/file/lockf.c index f95b24fac..0962031da 100644 --- a/libc/misc/file/lockf.c +++ b/libc/misc/file/lockf.c @@ -28,7 +28,7 @@ int lockf (int fd, int cmd, off_t len) { struct flock fl; - memset ((char *) &fl, '\0', sizeof (fl)); + __memset ((char *) &fl, '\0', sizeof (fl)); /* lockf is always relative to the current file position. */ fl.l_whence = SEEK_CUR; diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c index 5638d6938..eb70e8ddd 100644 --- a/libc/misc/file/lockf64.c +++ b/libc/misc/file/lockf64.c @@ -62,7 +62,7 @@ int lockf64 (int fd, int cmd, off64_t len64) return -1; } - memset((char *) &fl, '\0', sizeof (fl)); + __memset((char *) &fl, '\0', sizeof (fl)); /* lockf is always relative to the current file position. */ fl.l_whence = SEEK_CUR; diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 48b385c19..c36ae45b6 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -18,7 +18,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define mempcpy __libc_mempcpy +/* used by D_EXACT_NAMLEN */ +#define strlen __strlen + +#define mempcpy __mempcpy #define tsearch __tsearch #define _GNU_SOURCE @@ -424,7 +427,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st) /* Next, update the `struct FTW' information. */ ++data->ftw.level; - startp = strchr (data->dirbuf, '\0'); + startp = __strchr (data->dirbuf, '\0'); /* There always must be a directory name. */ assert (startp != data->dirbuf); if (startp[-1] != '/') @@ -460,7 +463,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st) while (result == 0 && *runp != '\0') { - char *endp = strchr (runp, '\0'); + char *endp = __strchr (runp, '\0'); result = process_entry (data, &dir, runp, endp - runp); @@ -501,7 +504,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flag __set_errno (ENOENT); return -1; } - if ((strlen(dir)+1) > NAME_MAX) { + if ((__strlen(dir)+1) > NAME_MAX) { __set_errno(ENAMETOOLONG); return -1; } @@ -510,10 +513,10 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flag data.actdir = 0; data.dirstreams = (struct dir_data **) alloca (data.maxdir * sizeof (struct dir_data *)); - memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *)); + __memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *)); /* PATH_MAX is always defined when we get here. */ - data.dirbufsize = MAX (2 * strlen (dir), PATH_MAX); + data.dirbufsize = MAX (2 * __strlen (dir), PATH_MAX); data.dirbuf = (char *) malloc (data.dirbufsize); if (data.dirbuf == NULL) return -1; diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index 246402113..22f1874ab 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -127,7 +127,7 @@ glob (pattern, flags, errfunc, pglob) { dirlen = filename - pattern; dirname = (char *) alloca (dirlen + 1); - memcpy (dirname, pattern, dirlen); + __memcpy (dirname, pattern, dirlen); dirname[dirlen] = '\0'; ++filename; } @@ -219,11 +219,11 @@ glob (pattern, flags, errfunc, pglob) /* No matches. */ if (flags & GLOB_NOCHECK) { - size_t len = strlen (pattern) + 1; + size_t len = __strlen (pattern) + 1; char *patcopy = (char *) malloc (len); if (patcopy == NULL) return GLOB_NOSPACE; - memcpy (patcopy, pattern, len); + __memcpy (patcopy, pattern, len); pglob->gl_pathv = (char **) realloc (pglob->gl_pathv, @@ -281,7 +281,7 @@ glob (pattern, flags, errfunc, pglob) for (i = oldcount; i < pglob->gl_pathc; ++i) if (lstat (pglob->gl_pathv[i], &st) == 0 && S_ISDIR (st.st_mode)) - strcat (pglob->gl_pathv[i], "/"); + __strcat (pglob->gl_pathv[i], "/"); } if (!(flags & GLOB_NOSORT)) @@ -343,7 +343,7 @@ prefix_array (dirname, array, n, add_slash) int add_slash; { register size_t i; - size_t dirlen = strlen (dirname); + size_t dirlen = __strlen (dirname); if (dirlen == 1 && dirname[0] == '/') /* DIRNAME is just "/", so normal prepending would get us "//foo". @@ -352,7 +352,7 @@ prefix_array (dirname, array, n, add_slash) for (i = 0; i < n; ++i) { - size_t eltlen = strlen (array[i]) + 1; + size_t eltlen = __strlen (array[i]) + 1; char *new = (char *) malloc (dirlen + 1 + eltlen + (add_slash ? 1 : 0)); if (new == NULL) { @@ -361,9 +361,9 @@ prefix_array (dirname, array, n, add_slash) return 1; } - memcpy (new, dirname, dirlen); + __memcpy (new, dirname, dirlen); new[dirlen] = '/'; - memcpy (&new[dirlen + 1], array[i], eltlen); + __memcpy (&new[dirlen + 1], array[i], eltlen); free ((__ptr_t) array[i]); array[i] = new; } @@ -436,7 +436,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) #endif } - if ((!meta && strcmp (pattern, name) == 0) + if ((!meta && __strcmp (pattern, name) == 0) || fnmatch (pattern, name, (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)) == 0) @@ -444,12 +444,12 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) struct globlink *new = (struct globlink *) alloca (sizeof (struct globlink)); if (len == 0) - len = strlen (name); + len = __strlen (name); new->name = (char *) malloc (len + ((flags & GLOB_MARK) ? 1 : 0) + 1); if (new->name == NULL) goto memory_error; - memcpy ((__ptr_t) new->name, name, len); + __memcpy ((__ptr_t) new->name, name, len); new->name[len] = '\0'; new->next = names; names = new; @@ -461,14 +461,14 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (nfound == 0 && (flags & GLOB_NOCHECK)) { - size_t len = strlen (pattern); + size_t len = __strlen (pattern); nfound = 1; names = (struct globlink *) alloca (sizeof (struct globlink)); names->next = NULL; names->name = (char *) malloc (len + (flags & GLOB_MARK ? 1 : 0) + 1); if (names->name == NULL) goto memory_error; - memcpy (names->name, pattern, len); + __memcpy (names->name, pattern, len); names->name[len] = '\0'; } diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 48b3b6e7d..a46465398 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -80,9 +80,9 @@ const char *__progname = 0; #endif extern int __libc_fcntl(int fd, int cmd, ...); -extern int __libc_open(const char *file, int flags, ...); #ifdef __ARCH_HAS_MMU__ + static void __check_one_fd(int fd, int mode) { /* Check if the specified fd is already open */ @@ -90,7 +90,7 @@ static void __check_one_fd(int fd, int mode) { /* The descriptor is probably not open, so try to use /dev/null */ struct stat st; - int nullfd = __libc_open(_PATH_DEVNULL, mode); + int nullfd = __open(_PATH_DEVNULL, mode); /* /dev/null is major=1 minor=3. Make absolutely certain * that is in fact the device that we have opened and not * some other wierd file... */ @@ -229,7 +229,7 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, while (*aux_dat) { ElfW(auxv_t) *auxv_entry = (ElfW(auxv_t) *) aux_dat; if (auxv_entry->a_type <= AT_EGID) { - memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t))); + __memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t))); } aux_dat += 2; } diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 589d627ae..360c76879 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -31,6 +31,8 @@ * Use brain damaged getpid() if real random fails. */ +#define open64 __open64 + #include #include #include @@ -72,7 +74,7 @@ int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir } else { - plen = strlen (pfx); + plen = __strlen (pfx); if (plen > 5) plen = 5; } @@ -94,7 +96,7 @@ int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir { if (direxists (P_tmpdir)) dir = P_tmpdir; - else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) + else if (__strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) dir = "/tmp"; else { @@ -103,7 +105,7 @@ int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir } } - dlen = strlen (dir); + dlen = __strlen (dir); while (dlen > 1 && dir[dlen - 1] == '/') dlen--; /* remove trailing slashes */ @@ -126,13 +128,13 @@ static unsigned int fillrand(unsigned char *buf, unsigned int len) { int fd; unsigned int result = -1; - fd = open("/dev/urandom", O_RDONLY); + fd = __open("/dev/urandom", O_RDONLY); if (fd < 0) { - fd = open("/dev/random", O_RDONLY | O_NONBLOCK); + fd = __open("/dev/random", O_RDONLY | O_NONBLOCK); } if (fd >= 0) { - result = read(fd, buf, len); - close(fd); + result = __read(fd, buf, len); + __close(fd); } return result; } @@ -182,8 +184,8 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind) int len, i, count, fd, save_errno = errno; unsigned char randomness[6]; - len = strlen (tmpl); - if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) + len = __strlen (tmpl); + if (len < 6 || __strcmp (&tmpl[len - 6], "XXXXXX")) { __set_errno (EINVAL); return -1; @@ -223,7 +225,7 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind) continue; } case __GT_FILE: - fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); break; #if defined __UCLIBC_HAS_LFS__ case __GT_BIGFILE: diff --git a/libc/misc/intl/intl.c b/libc/misc/intl/intl.c index f3255828c..e882f441c 100644 --- a/libc/misc/intl/intl.c +++ b/libc/misc/intl/intl.c @@ -60,7 +60,7 @@ char *__uClibc_textdomain(const char *domainname) { static const char default_str[] = "messages"; - if (domainname && *domainname && strcmp(domainname, default_str)) { + if (domainname && *domainname && __strcmp(domainname, default_str)) { __set_errno(EINVAL); return NULL; } @@ -82,7 +82,7 @@ char *__uClibc_bindtextdomain(const char *domainname, const char *dirname) #if 1 && ((dirname[0] != '/') || dirname[1]) #else - && strcmp(dirname, dir) + && __strcmp(dirname, dir) #endif ) ) { diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index f46dabc2d..77d3f1e5d 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -155,7 +155,7 @@ char *setlocale(int category, register const char *locale) && ( (!locale) /* Request for locale category string. */ || (!*locale) /* Implementation-defined default is C. */ || ((*locale == 'C') && !locale[1]) - || (!strcmp(locale, "POSIX"))) ) + || (!__strcmp(locale, "POSIX"))) ) ? (char *) C_string /* Always in C/POSIX locale. */ : NULL; } @@ -226,7 +226,7 @@ static void update_hr_locale(const unsigned char *spec) *n = 0; } else { char at = 0; - memcpy(n, LOCALE_NAMES + 5*((*loc)-1), 5); + __memcpy(n, LOCALE_NAMES + 5*((*loc)-1), 5); if (n[2] != '_') { at = n[2]; n[2] = '_'; @@ -455,7 +455,7 @@ static int init_cur_collate(int der_num, __collate_t *cur_collate) + cdd->base_idx * sizeof(coldata_base_t) )/2 ); - memcpy(cur_collate, cdb, offsetof(coldata_base_t,index2weight_offset)); + __memcpy(cur_collate, cdb, offsetof(coldata_base_t,index2weight_offset)); cur_collate->undefined_idx = cdd->undefined_idx; cur_collate->ti_mask = (1 << cur_collate->ti_shift)-1; @@ -507,9 +507,9 @@ static int init_cur_collate(int der_num, __collate_t *cur_collate) cur_collate->index2ruleidx = cur_collate->index2weight + cur_collate->max_col_index + 1; - memcpy(cur_collate->index2weight, cur_collate->index2weight_tbl, + __memcpy(cur_collate->index2weight, cur_collate->index2weight_tbl, cur_collate->num_col_base * sizeof(uint16_t)); - memcpy(cur_collate->index2ruleidx, cur_collate->index2ruleidx_tbl, + __memcpy(cur_collate->index2ruleidx, cur_collate->index2ruleidx_tbl, cur_collate->num_col_base * sizeof(uint16_t)); /* now do the overrides */ @@ -594,7 +594,7 @@ int _locale_set_l(const unsigned char *p, __locale_t base) return 0; /* calloc failed. */ } free(base->collate.index2weight); - memcpy(&base->collate, &newcol, sizeof(__collate_t)); + __memcpy(&base->collate, &newcol, sizeof(__collate_t)); } do { @@ -664,15 +664,15 @@ int _locale_set_l(const unsigned char *p, __locale_t base) * All of this will be replaced in the next generation * of locale support anyway... */ - memcpy(base->__ctype_b_data, + __memcpy(base->__ctype_b_data, __C_ctype_b - __UCLIBC_CTYPE_B_TBL_OFFSET, (256 + __UCLIBC_CTYPE_B_TBL_OFFSET) * sizeof(__ctype_mask_t)); - memcpy(base->__ctype_tolower_data, + __memcpy(base->__ctype_tolower_data, __C_ctype_tolower - __UCLIBC_CTYPE_TO_TBL_OFFSET, (256 + __UCLIBC_CTYPE_TO_TBL_OFFSET) * sizeof(__ctype_touplow_t)); - memcpy(base->__ctype_toupper_data, + __memcpy(base->__ctype_toupper_data, __C_ctype_toupper - __UCLIBC_CTYPE_TO_TBL_OFFSET, (256 + __UCLIBC_CTYPE_TO_TBL_OFFSET) * sizeof(__ctype_touplow_t)); @@ -782,7 +782,7 @@ int _locale_set_l(const unsigned char *p, __locale_t base) d = base->outdigit_length; x = &base->outdigit0_mb; for (c = 0 ; c < 10 ; c++) { - ((unsigned char *)d)[c] = strlen(x[c]); + ((unsigned char *)d)[c] = __strlen(x[c]); assert(d[c] > 0); } } else if (i == LC_NUMERIC) { @@ -847,10 +847,10 @@ static const uint16_t __code2flag[16] = { void _locale_init_l(__locale_t base) { - memset(base->cur_locale, 0, LOCALE_SELECTOR_SIZE); + __memset(base->cur_locale, 0, LOCALE_SELECTOR_SIZE); base->cur_locale[0] = '#'; - memcpy(base->category_item_count, + __memcpy(base->category_item_count, __locale_mmap->lc_common_item_offsets_LEN, LC_ALL); @@ -1072,14 +1072,14 @@ static int find_locale(int category_mask, const char *p, char buf[18]; /* TODO: 7+{max codeset name length} */ const char *q; - if ((q = strchr(p,'@')) != NULL) { + if ((q = __strchr(p,'@')) != NULL) { if ((((size_t)((q-p)-5)) > (sizeof(buf) - 5)) || (p[2] != '_')) { return 0; } /* locale name at least 5 chars long and 3rd char is '_' */ s = LOCALE_AT_MODIFIERS; do { - if (!strcmp(s+2, q+1)) { + if (!__strcmp(s+2, q+1)) { break; } s += 2 + *s; /* TODO - fix this throughout */ @@ -1088,7 +1088,7 @@ static int find_locale(int category_mask, const char *p, return 0; } assert(q - p < sizeof(buf)); - memcpy(buf, p, q-p); + __memcpy(buf, p, q-p); buf[q-p] = 0; buf[2] = s[1]; p = buf; @@ -1096,19 +1096,19 @@ static int find_locale(int category_mask, const char *p, #endif lang_cult = codeset = 0; /* Assume C and default codeset. */ - if (((*p == 'C') && !p[1]) || !strcmp(p, posix)) { + if (((*p == 'C') && !p[1]) || !__strcmp(p, posix)) { goto FIND_LOCALE; } - if ((strlen(p) > 5) && (p[5] == '.')) { /* Codeset in locale name? */ + if ((__strlen(p) > 5) && (p[5] == '.')) { /* Codeset in locale name? */ /* TODO: maybe CODESET_LIST + *s ??? */ /* 7bit is 1, UTF-8 is 2, 8-bit is >= 3 */ codeset = 2; - if (strcmp(utf8,p+6) != 0) {/* TODO - fix! */ + if (__strcmp(utf8,p+6) != 0) {/* TODO - fix! */ s = CODESET_LIST; do { ++codeset; /* Increment codeset first. */ - if (!strcmp(CODESET_LIST+*s, p+6)) { + if (!__strcmp(CODESET_LIST+*s, p+6)) { goto FIND_LANG_CULT; } } while (*++s); @@ -1121,7 +1121,7 @@ static int find_locale(int category_mask, const char *p, do { /* TODO -- do a binary search? */ /* TODO -- fix gen_mmap!*/ ++lang_cult; /* Increment first since C/POSIX is 0. */ - if (!strncmp(s,p,5)) { /* Found a matching locale name; */ + if (!__strncmp(s,p,5)) { /* Found a matching locale name; */ goto FIND_LOCALE; } s += 5; @@ -1163,14 +1163,14 @@ static unsigned char *composite_locale(int category_mask, const char *locale, int c; int component_mask; - if (!strchr(locale,'=')) { + if (!__strchr(locale,'=')) { if (!find_locale(category_mask, locale, new_locale)) { return NULL; } return new_locale; } - if (strlen(locale) >= sizeof(buf)) { + if (__strlen(locale) >= sizeof(buf)) { return NULL; } stpcpy(buf, locale); @@ -1179,7 +1179,7 @@ static unsigned char *composite_locale(int category_mask, const char *locale, t = strtok_r(buf, "=", &e); /* This can't fail because of strchr test above. */ do { c = 0; - while (strcmp(CATEGORY_NAMES + (int) CATEGORY_NAMES[c], t)) { + while (__strcmp(CATEGORY_NAMES + (int) CATEGORY_NAMES[c], t)) { if (++c == LC_ALL) { /* Unknown category name! */ return NULL; } @@ -1221,7 +1221,7 @@ __locale_t __newlocale(int category_mask, const char *locale, __locale_t base) #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Rename cur_locale to locale_selector. #endif - strcpy((char *) new_selector, + __strcpy((char *) new_selector, (base ? (char *) base->cur_locale : C_LOCALE_SELECTOR)); if (!*locale) { /* locale == "", so check environment. */ @@ -1310,9 +1310,9 @@ __locale_t __duplocale(__locale_t dataset) if ((i2w = calloc(n, sizeof(uint16_t))) != NULL ) { - memcpy(r, dataset, sizeof(__uclibc_locale_t)); + __memcpy(r, dataset, sizeof(__uclibc_locale_t)); r->collate.index2weight = i2w; - memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t)); + __memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t)); } else { free(r); r = NULL; diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 5e09af6d9..d367211c5 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -44,6 +44,15 @@ extern wctype_t __wctype (__const char *__property) attribute_hidden; extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/; #endif + +#define memcmp __memcmp +#define memcpy __memcpy +#define memmove __memmove +#define memset __memset +#define strchr __strchr +#define strcmp __strcmp +#define strlen __strlen +#define strncpy __strncpy #endif /* Make sure noone compiles this code with a C++ compiler. */ diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 3e9d2eb30..cdf2f940a 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -21,7 +21,6 @@ 02111-1307 USA. */ #define HAVE_MEMPCPY -#define __mempcpy __libc_mempcpy #define memset __memset #define memcmp __memcmp #define strcmp __strcmp @@ -40,8 +39,8 @@ #define STDC_HEADERS #define RE_TRANSLATE_TYPE char * -extern void *__libc_mempcpy (void *__restrict __dest, - __const void *__restrict __src, size_t __n) /*attribute_hidden*/; +extern void *__mempcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) attribute_hidden; /* AIX requires this to be the first thing in the file. */ #if defined _AIX && !defined REGEX_MALLOC diff --git a/libc/misc/search/hsearch_r.c b/libc/misc/search/hsearch_r.c index 10efb1a88..0f96180b1 100644 --- a/libc/misc/search/hsearch_r.c +++ b/libc/misc/search/hsearch_r.c @@ -140,7 +140,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, { unsigned int hval; unsigned int count; - unsigned int len = strlen (item.key); + unsigned int len = __strlen (item.key); unsigned int idx; /* Compute an value for the given string. Perhaps use a better method. */ @@ -166,7 +166,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, unsigned hval2; if (htab->table[idx].used == hval - && strcmp (item.key, htab->table[idx].entry.key) == 0) + && __strcmp (item.key, htab->table[idx].entry.key) == 0) { *retval = &htab->table[idx].entry; return 1; @@ -190,7 +190,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, /* If entry is found use it. */ if (htab->table[idx].used == hval - && strcmp (item.key, htab->table[idx].entry.key) == 0) + && __strcmp (item.key, htab->table[idx].entry.key) == 0) { *retval = &htab->table[idx].entry; return 1; diff --git a/libc/misc/search/lsearch.c b/libc/misc/search/lsearch.c index 2a9996d47..4bc45ca36 100644 --- a/libc/misc/search/lsearch.c +++ b/libc/misc/search/lsearch.c @@ -37,7 +37,7 @@ void *lsearch(const void *key, void *base, size_t *nmemb, register char *p; if ((p = lfind(key, base, nmemb, size, compar)) == NULL) { - p = memcpy((base + (size * (*nmemb))), key, size); + p = __memcpy((base + (size * (*nmemb))), key, size); ++(*nmemb); } return (p); diff --git a/libc/misc/statfs/fstatfs64.c b/libc/misc/statfs/fstatfs64.c index 1040e1fe1..b793002fb 100644 --- a/libc/misc/statfs/fstatfs64.c +++ b/libc/misc/statfs/fstatfs64.c @@ -57,7 +57,7 @@ int fstatfs64 (int fd, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; - memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + __memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; } diff --git a/libc/misc/statfs/internal_statvfs.c b/libc/misc/statfs/internal_statvfs.c index aa7af44f5..8f7e386c4 100644 --- a/libc/misc/statfs/internal_statvfs.c +++ b/libc/misc/statfs/internal_statvfs.c @@ -39,7 +39,7 @@ buf->__f_unused = 0; #endif buf->f_namemax = fsbuf.f_namelen; - memset (buf->__f_spare, '\0', 6 * sizeof (int)); + __memset (buf->__f_spare, '\0', 6 * sizeof (int)); /* What remains to do is to fill the fields f_favail and f_flag. */ @@ -79,21 +79,21 @@ char *opt; while ((opt = strsep (&cp, ",")) != NULL) - if (strcmp (opt, "ro") == 0) + if (__strcmp (opt, "ro") == 0) buf->f_flag |= ST_RDONLY; - else if (strcmp (opt, "nosuid") == 0) + else if (__strcmp (opt, "nosuid") == 0) buf->f_flag |= ST_NOSUID; - else if (strcmp (opt, "noexec") == 0) + else if (__strcmp (opt, "noexec") == 0) buf->f_flag |= ST_NOEXEC; - else if (strcmp (opt, "nodev") == 0) + else if (__strcmp (opt, "nodev") == 0) buf->f_flag |= ST_NODEV; - else if (strcmp (opt, "sync") == 0) + else if (__strcmp (opt, "sync") == 0) buf->f_flag |= ST_SYNCHRONOUS; - else if (strcmp (opt, "mand") == 0) + else if (__strcmp (opt, "mand") == 0) buf->f_flag |= ST_MANDLOCK; - else if (strcmp (opt, "noatime") == 0) + else if (__strcmp (opt, "noatime") == 0) buf->f_flag |= ST_NOATIME; - else if (strcmp (opt, "nodiratime") == 0) + else if (__strcmp (opt, "nodiratime") == 0) buf->f_flag |= ST_NODIRATIME; /* We can stop looking for more entries. */ diff --git a/libc/misc/statfs/statfs64.c b/libc/misc/statfs/statfs64.c index 0b954c675..7144cce71 100644 --- a/libc/misc/statfs/statfs64.c +++ b/libc/misc/statfs/statfs64.c @@ -55,7 +55,7 @@ int statfs64 (const char *file, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; - memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + __memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; } diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index dc30db913..69ff0b38b 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -31,8 +31,6 @@ * SUCH DAMAGE. */ -#define memmove __memmove - #define __FORCE_GLIBC #define _GNU_SOURCE #include @@ -114,7 +112,7 @@ closelog_intern(int to_default) { LOCK; if (LogFile != -1) { - (void) close(LogFile); + (void) __close(LogFile); } LogFile = -1; connected = 0; @@ -160,7 +158,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) struct sigaction action, oldaction; int sigpipe; - memset (&action, 0, sizeof (action)); + __memset (&action, 0, sizeof (action)); action.sa_handler = sigpipe_handler; sigemptyset (&action.sa_mask); sigpipe = sigaction (SIGPIPE, &action, &oldaction); @@ -186,7 +184,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) (void)time(&now); stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4); if (LogTag) { - if (strlen(LogTag) < sizeof(tbuf) - 64) + if (__strlen(LogTag) < sizeof(tbuf) - 64) p += sprintf(p, "%s", LogTag); else p += sprintf(p, ""); @@ -209,9 +207,9 @@ vsyslog( int pri, const char *fmt, va_list ap ) p += vsnprintf(p, end - p, fmt, ap); if (p >= end || p < head_end) { /* Returned -1 in case of error... */ static const char truncate_msg[12] = "[truncated] "; - memmove(head_end + sizeof(truncate_msg), head_end, + __memmove(head_end + sizeof(truncate_msg), head_end, end - head_end - sizeof(truncate_msg)); - memcpy(head_end, truncate_msg, sizeof(truncate_msg)); + __memcpy(head_end, truncate_msg, sizeof(truncate_msg)); if (p < head_end) { while (p < end && *p) { p++; @@ -227,14 +225,14 @@ vsyslog( int pri, const char *fmt, va_list ap ) /* Output to stderr if requested. */ if (LogStat & LOG_PERROR) { *last_chr = '\n'; - (void)write(STDERR_FILENO, stdp, last_chr - stdp + 1); + (void)__write(STDERR_FILENO, stdp, last_chr - stdp + 1); } /* Output the message to the local logger using NUL as a message delimiter. */ p = tbuf; *last_chr = 0; do { - rc = write(LogFile, p, last_chr + 1 - p); + rc = __write(LogFile, p, last_chr + 1 - p); if (rc < 0) { if ((errno==EAGAIN) || (errno==EINTR)) rc=0; @@ -255,12 +253,12 @@ vsyslog( int pri, const char *fmt, va_list ap ) */ /* should mode be `O_WRONLY | O_NOCTTY' ? -- Uli */ if (LogStat & LOG_CONS && - (fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { - p = strchr(tbuf, '>') + 1; + (fd = __open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { + p = __strchr(tbuf, '>') + 1; last_chr[0] = '\r'; last_chr[1] = '\n'; - (void)write(fd, p, last_chr - p + 2); - (void)close(fd); + (void)__write(fd, p, last_chr - p + 2); + (void)__close(fd); } getout: @@ -287,7 +285,7 @@ openlog( const char *ident, int logstat, int logfac ) LogFacility = logfac; if (LogFile == -1) { SyslogAddr.sa_family = AF_UNIX; - (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, + (void)__strncpy(SyslogAddr.sa_data, _PATH_LOG, sizeof(SyslogAddr.sa_data)); retry: if (LogStat & LOG_NDELAY) { @@ -301,19 +299,19 @@ retry: if (LogFile != -1 && !connected) { if (connect(LogFile, &SyslogAddr, sizeof(SyslogAddr) - - sizeof(SyslogAddr.sa_data) + strlen(SyslogAddr.sa_data)) != -1) + sizeof(SyslogAddr.sa_data) + __strlen(SyslogAddr.sa_data)) != -1) { connected = 1; } else if (logType == SOCK_DGRAM) { logType = SOCK_STREAM; if (LogFile != -1) { - close(LogFile); + __close(LogFile); LogFile = -1; } goto retry; } else { if (LogFile != -1) { - close(LogFile); + __close(LogFile); LogFile = -1; } } diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index e1e86db91..4d3c43492 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -131,7 +131,6 @@ #define _uintmaxtostr __libc__uintmaxtostr #define strnlen __strnlen -#define memcpy __memcpy #define _GNU_SOURCE #include @@ -316,23 +315,23 @@ char attribute_hidden *__asctime_r(register const struct tm *__restrict ptm, assert(buffer); #ifdef SAFE_ASCTIME_R - memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12)); + __memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12)); if (((unsigned int)(ptm->tm_wday)) <= 6) { - memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); + __memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); } if (((unsigned int)(ptm->tm_mon)) <= 11) { - memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); + __memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); } #else assert(((unsigned int)(ptm->tm_wday)) <= 6); assert(((unsigned int)(ptm->tm_mon)) <= 11); - memcpy(buffer, at_data + 3*(7 + 12) - 3, sizeof(at_data) + 3 - 3*(7 + 12)); + __memcpy(buffer, at_data + 3*(7 + 12) - 3, sizeof(at_data) + 3 - 3*(7 + 12)); - memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); - memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); + __memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); + __memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); #endif #ifdef SAFE_ASCTIME_R @@ -587,7 +586,7 @@ static const char *lookup_tzname(const char *key) ll_tzname_item_t *p; for (p=ll_tzname ; p ; p=p->next) { - if (!strcmp(p->tzname, key)) { + if (!__strcmp(p->tzname, key)) { return p->tzname; } } @@ -598,7 +597,7 @@ static const char *lookup_tzname(const char *key) /* Insert as 3rd item in the list. */ p->next = ll_tzname[1].next; ll_tzname[1].next = p; - strcpy(p->tzname, key); + __strcpy(p->tzname, key); return p->tzname; } } @@ -742,8 +741,8 @@ time_t timegm(struct tm *timeptr) { rule_struct gmt_tzinfo[2]; - memset(gmt_tzinfo, 0, sizeof(gmt_tzinfo)); - strcpy(gmt_tzinfo[0].tzname, "GMT"); /* Match glibc behavior here. */ + __memset(gmt_tzinfo, 0, sizeof(gmt_tzinfo)); + __strcpy(gmt_tzinfo[0].tzname, "GMT"); /* Match glibc behavior here. */ return _time_mktime_tzi(timeptr, 1, gmt_tzinfo); } @@ -1503,7 +1502,7 @@ char *__XL(strptime)(const char *__restrict buf, const char *__restrict format, do { --j; o = __XL(nl_langinfo)(i+j __LOCALE_ARG); - if (!__XL(strncasecmp)(buf,o,strlen(o) __LOCALE_ARG) && *o) { + if (!__XL(strncasecmp)(buf,o,__strlen(o) __LOCALE_ARG) && *o) { do { /* Found a match. */ ++buf; } while (*++o); @@ -1758,11 +1757,11 @@ static char *read_TZ_file(char *buf) size_t todo; char *p = NULL; - if ((fd = open(__UCLIBC_TZ_FILE_PATH__, O_RDONLY)) >= 0) { + if ((fd = __open(__UCLIBC_TZ_FILE_PATH__, O_RDONLY)) >= 0) { todo = TZ_BUFLEN; p = buf; do { - if ((r = read(fd, p, todo)) < 0) { + if ((r = __read(fd, p, todo)) < 0) { goto ERROR; } if (r == 0) { @@ -1782,7 +1781,7 @@ static char *read_TZ_file(char *buf) ERROR: p = NULL; } - close(fd); + __close(fd); } return p; } @@ -1834,8 +1833,8 @@ void tzset(void) #ifdef __UCLIBC_HAS_TZ_CACHING__ *oldval = 0; /* Set oldval to an empty string. */ #endif /* __UCLIBC_HAS_TZ_CACHING__ */ - memset(_time_tzinfo, 0, 2*sizeof(rule_struct)); - strcpy(_time_tzinfo[0].tzname, UTC); + __memset(_time_tzinfo, 0, 2*sizeof(rule_struct)); + __strcpy(_time_tzinfo[0].tzname, UTC); goto DONE; } @@ -1844,13 +1843,13 @@ void tzset(void) } #ifdef __UCLIBC_HAS_TZ_CACHING__ - if (strcmp(e, oldval) == 0) { /* Same string as last time... */ + if (__strcmp(e, oldval) == 0) { /* Same string as last time... */ goto FAST_DONE; /* So nothing to do. */ } /* Make a copy of the TZ env string. It won't be nul-terminated if * it is too long, but it that case it will be illegal and will be reset * to the empty string anyway. */ - strncpy(oldval, e, TZ_BUFLEN); + __strncpy(oldval, e, TZ_BUFLEN); #endif /* __UCLIBC_HAS_TZ_CACHING__ */ count = 0; @@ -1964,7 +1963,7 @@ void tzset(void) } } - memcpy(_time_tzinfo, new_rules, sizeof(new_rules)); + __memcpy(_time_tzinfo, new_rules, sizeof(new_rules)); DONE: tzname[0] = _time_tzinfo[0].tzname; tzname[1] = _time_tzinfo[1].tzname; @@ -2211,7 +2210,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes register const unsigned char *s; int d, default_dst; - memcpy(p, timeptr, sizeof(struct tm)); + __memcpy(p, timeptr, sizeof(struct tm)); if (!tzi[1].tzname[0]) { /* No dst in this timezone, */ p[8] = 0; /* so set tm_isdst to 0. */ @@ -2301,7 +2300,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes if (store_on_success) { - memcpy(timeptr, p, sizeof(struct tm)); + __memcpy(timeptr, p, sizeof(struct tm)); } diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index 7c734dc0b..c15228a24 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/libc/misc/ttyent/getttyent.c @@ -52,7 +52,7 @@ struct ttyent * getttynam(const char *tty) setttyent(); while ((t = getttyent())) - if (!strcmp(tty, t->ty_name)) + if (!__strcmp(tty, t->ty_name)) break; endttyent(); return (t); @@ -98,7 +98,7 @@ static char * skip(register char *p) static char * value(register char *p) { - return ((p = strchr(p, '=')) ? ++p : NULL); + return ((p = __strchr(p, '=')) ? ++p : NULL); } struct ttyent * getttyent(void) @@ -124,7 +124,7 @@ struct ttyent * getttyent(void) return (NULL); } /* skip lines that are too big */ - if (!strchr(p, '\n')) { + if (!__strchr(p, '\n')) { while ((c = getc_unlocked(tf)) != '\n' && c != EOF) ; continue; @@ -150,8 +150,8 @@ struct ttyent * getttyent(void) tty.ty_status = 0; tty.ty_window = NULL; -#define scmp(e) !strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1]) -#define vcmp(e) !strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '=' +#define scmp(e) !__strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1]) +#define vcmp(e) !__strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '=' for (; *p; p = skip(p)) { if (scmp(_TTYS_OFF)) tty.ty_status &= ~TTY_ON; @@ -173,7 +173,7 @@ struct ttyent * getttyent(void) tty.ty_comment = p; if (*p == 0) tty.ty_comment = 0; - if ((p = strchr(p, '\n'))) + if ((p = __strchr(p, '\n'))) *p = '\0'; return (&tty); } diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index aa74cb544..c3d9ab620 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -53,7 +53,7 @@ static struct utmp *__getutent(int utmp_fd) } LOCK; - if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) { return NULL; } @@ -68,8 +68,8 @@ void setutent(void) LOCK; if (static_fd == -1) { - if ((static_fd = open(static_ut_name, O_RDWR)) < 0) { - if ((static_fd = open(static_ut_name, O_RDONLY)) < 0) { + if ((static_fd = __open(static_ut_name, O_RDWR)) < 0) { + if ((static_fd = __open(static_ut_name, O_RDONLY)) < 0) { goto bummer; } } @@ -82,7 +82,7 @@ void setutent(void) bummer: UNLOCK; static_fd = -1; - close(static_fd); + __close(static_fd); return; } } @@ -95,7 +95,7 @@ void endutent(void) { LOCK; if (static_fd != -1) { - close(static_fd); + __close(static_fd); } static_fd = -1; UNLOCK; @@ -125,7 +125,7 @@ struct utmp attribute_hidden *__getutid (const struct utmp *utmp_entry) utmp_entry->ut_type == DEAD_PROCESS || utmp_entry->ut_type == LOGIN_PROCESS || utmp_entry->ut_type == USER_PROCESS) && - !strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) + !__strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) { return lutmp; } @@ -142,7 +142,7 @@ struct utmp *getutline(const struct utmp *utmp_entry) while ((lutmp = __getutent(static_fd)) != NULL) { if ((lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) && - !strcmp(lutmp->ut_line, utmp_entry->ut_line)) + !__strcmp(lutmp->ut_line, utmp_entry->ut_line)) { return lutmp; } @@ -162,11 +162,11 @@ struct utmp *pututline (const struct utmp *utmp_entry) if (__getutid(utmp_entry) != NULL) { lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); - if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) return NULL; } else { lseek(static_fd, (off_t) 0, SEEK_END); - if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) return NULL; } @@ -180,7 +180,7 @@ int utmpname (const char *new_ut_name) if (new_ut_name != NULL) { if (static_ut_name != default_file_name) free((char *)static_ut_name); - static_ut_name = strdup(new_ut_name); + static_ut_name = __strdup(new_ut_name); if (static_ut_name == NULL) { /* We should probably whine about out-of-memory * errors here... Instead just reset to the default */ @@ -189,7 +189,7 @@ int utmpname (const char *new_ut_name) } if (static_fd != -1) - close(static_fd); + __close(static_fd); UNLOCK; return 0; } diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index ef5663feb..bb5244878 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -31,13 +31,13 @@ void logwtmp (const char *line, const char *name, const char *host) { struct utmp lutmp; - memset (&(lutmp), 0, sizeof (struct utmp)); + __memset (&(lutmp), 0, sizeof (struct utmp)); lutmp.ut_type = (name && *name)? USER_PROCESS : DEAD_PROCESS; lutmp.ut_pid = getpid(); - strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); - strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); - strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); + __strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); + __strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); + __strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); gettimeofday(&(lutmp.ut_tv), NULL); updwtmp(_PATH_WTMP, &(lutmp)); @@ -48,12 +48,12 @@ extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp) { int fd; - fd = open(wtmp_file, O_APPEND | O_WRONLY, 0); + fd = __open(wtmp_file, O_APPEND | O_WRONLY, 0); if (fd >= 0) { if (lockf(fd, F_LOCK, 0)==0) { - write(fd, (const char *) lutmp, sizeof(struct utmp)); + __write(fd, (const char *) lutmp, sizeof(struct utmp)); lockf(fd, F_ULOCK, 0); - close(fd); + __close(fd); } } } diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 055900827..1691e00e0 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -98,8 +98,6 @@ * Manuel */ -#define memmove __memmove - #define _GNU_SOURCE #define _ISOC99_SOURCE #include @@ -1620,7 +1618,7 @@ int main(int argc, char **argv) break; } do { - if ((s = strchr(opt_chars,*p)) == NULL) { + if ((s = __strchr(opt_chars,*p)) == NULL) { USAGE: s = basename(progname); fprintf(stderr, @@ -1697,7 +1695,7 @@ int main(int argc, char **argv) } } if (ni) { /* still bytes in buffer! */ - memmove(ibuf, pi, ni); + __memmove(ibuf, pi, ni); } } diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c index ba902ba74..aa2b97d60 100644 --- a/libc/misc/wctype/wctype.c +++ b/libc/misc/wctype/wctype.c @@ -490,7 +490,7 @@ wctype_t attribute_hidden __wctype(const char *property) p = typestring; i = 1; do { - if (!strcmp(property, ++p)) { + if (!__strcmp(property, ++p)) { return i; } ++i; @@ -886,7 +886,7 @@ wctrans_t wctrans(const char *property) p = transstring; i = 1; do { - if (!strcmp(property, ++p)) { + if (!__strcmp(property, ++p)) { return i; } ++i; diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index da20ad0a4..5e9133c83 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -19,7 +19,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define mempcpy __libc_mempcpy +#define mempcpy __mempcpy #define strndup __strndup #define strspn __strspn #define unsetenv __unsetenv @@ -135,7 +135,7 @@ static char *w_addstr(char *buffer, size_t * actlen, size_t * maxlen, { size_t len; assert(str != NULL); /* w_addstr only called from this file */ - len = strlen(str); + len = __strlen(str); return w_addmem(buffer, actlen, maxlen, str, len); } @@ -150,7 +150,7 @@ static int w_addword(wordexp_t * pwordexp, char *word) * the caller sees them. */ if (word == NULL) { - word = strdup(""); + word = __strdup(""); if (word == NULL) goto no_space; } @@ -252,7 +252,7 @@ parse_tilde(char **word, size_t * word_length, size_t * max_length, if (*word_length != 0) { if (!((*word)[*word_length - 1] == '=' && wordc == 0)) { if (!((*word)[*word_length - 1] == ':' - && strchr(*word, '=') && wordc == 0)) { + && __strchr(*word, '=') && wordc == 0)) { *word = w_addchar(*word, word_length, max_length, '~'); return *word ? 0 : WRDE_NOSPACE; } @@ -377,7 +377,7 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length, } for (match = 0; match < globbuf.gl_pathc; ++match) { - char *matching_word = strdup(globbuf.gl_pathv[match]); + char *matching_word = __strdup(globbuf.gl_pathv[match]); if (matching_word == NULL || w_addword(pwordexp, matching_word)) { globfree(&globbuf); @@ -404,8 +404,8 @@ parse_glob(char **word, size_t * word_length, size_t * max_length, glob_list.we_wordv = NULL; glob_list.we_offs = 0; for (; words[*offset] != '\0'; ++*offset) { - if ((ifs && strchr(ifs, words[*offset])) || - (!ifs && strchr(" \t\n", words[*offset]))) + if ((ifs && __strchr(ifs, words[*offset])) || + (!ifs && __strchr(" \t\n", words[*offset]))) /* Reached IFS */ break; @@ -762,24 +762,24 @@ exec_comm_child(char *comm, int *fildes, int showerr, int noexec) /* Redirect output. */ dup2(fildes[1], 1); - close(fildes[1]); + __close(fildes[1]); /* Redirect stderr to /dev/null if we have to. */ if (showerr == 0) { int fd; - close(2); - fd = open(_PATH_DEVNULL, O_WRONLY); + __close(2); + fd = __open(_PATH_DEVNULL, O_WRONLY); if (fd >= 0 && fd != 2) { dup2(fd, 2); - close(fd); + __close(fd); } } /* Make sure the subshell doesn't field-split on our behalf. */ unsetenv("IFS"); - close(fildes[0]); + __close(fildes[0]); execve(_PATH_BSHELL, (char *const *) args, __environ); /* Bad. What now? */ @@ -812,8 +812,8 @@ exec_comm(char *comm, char **word, size_t * word_length, if ((pid = fork()) < 0) { /* Bad */ - close(fildes[0]); - close(fildes[1]); + __close(fildes[0]); + __close(fildes[1]); return WRDE_NOSPACE; } @@ -822,17 +822,17 @@ exec_comm(char *comm, char **word, size_t * word_length, /* Parent */ - close(fildes[1]); + __close(fildes[1]); buffer = alloca(bufsize); if (!pwordexp) /* Quoted - no field splitting */ { while (1) { - if ((buflen = read(fildes[0], buffer, bufsize)) < 1) { + if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) { if (waitpid(pid, &status, WNOHANG) == 0) continue; - if ((buflen = read(fildes[0], buffer, bufsize)) < 1) + if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) break; } @@ -855,17 +855,17 @@ exec_comm(char *comm, char **word, size_t * word_length, */ while (1) { - if ((buflen = read(fildes[0], buffer, bufsize)) < 1) { + if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) { if (waitpid(pid, &status, WNOHANG) == 0) continue; - if ((buflen = read(fildes[0], buffer, bufsize)) < 1) + if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) break; } for (i = 0; i < buflen; ++i) { - if (strchr(ifs, buffer[i]) != NULL) { + if (__strchr(ifs, buffer[i]) != NULL) { /* Current character is IFS */ - if (strchr(ifs_white, buffer[i]) == NULL) { + if (__strchr(ifs_white, buffer[i]) == NULL) { /* Current character is IFS but not whitespace */ if (copying == 2) { /* current character @@ -959,7 +959,7 @@ exec_comm(char *comm, char **word, size_t * word_length, } } - close(fildes[0]); + __close(fildes[0]); /* Check for syntax error (re-execute but with "-n" flag) */ if (buflen < 1 && status != 0) { @@ -982,7 +982,7 @@ exec_comm(char *comm, char **word, size_t * word_length, no_space: kill(pid, SIGKILL); waitpid(pid, NULL, 0); - close(fildes[0]); + __close(fildes[0]); return WRDE_NOSPACE; } @@ -1181,7 +1181,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, goto envsubst; } while (isdigit(words[++*offset])); - } else if (strchr("*@$", words[*offset]) != NULL) { + } else if (__strchr("*@$", words[*offset]) != NULL) { /* Special parameter. */ special = 1; env = w_addchar(env, &env_length, &env_maxlen, words[*offset]); @@ -1217,7 +1217,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, break; case ':': - if (strchr("-=?+", words[1 + *offset]) == NULL) + if (__strchr("-=?+", words[1 + *offset]) == NULL) goto syntax; colon_seen = 1; @@ -1349,7 +1349,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Build up value parameter by parameter (copy them) */ for (p = 1; __libc_argv[p]; ++p) - plist_len += strlen(__libc_argv[p]) + 1; /* for space */ + plist_len += __strlen(__libc_argv[p]) + 1; /* for space */ value = malloc(plist_len); if (value == NULL) goto no_space; @@ -1379,7 +1379,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, goto no_space; for (p = 2; __libc_argv[p + 1]; p++) { - char *newword = strdup(__libc_argv[p]); + char *newword = __strdup(__libc_argv[p]); if (newword == NULL || w_addword(pwordexp, newword)) goto no_space; @@ -1559,7 +1559,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (value == NULL || pattern == NULL || *pattern == '\0') break; - end = value + strlen(value); + end = value + __strlen(value); switch (action) { case ACT_RP_SHORT_LEFT: @@ -1569,7 +1569,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (fnmatch(pattern, value, 0) != FNM_NOMATCH) { *p = c; if (free_value) { - char *newval = strdup(p); + char *newval = __strdup(p); if (newval == NULL) { free(value); @@ -1593,7 +1593,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (fnmatch(pattern, value, 0) != FNM_NOMATCH) { *p = c; if (free_value) { - char *newval = strdup(p); + char *newval = __strdup(p); if (newval == NULL) { free(value); @@ -1697,7 +1697,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Substitute NULL */ goto success; - value = pattern ? strdup(pattern) : pattern; + value = pattern ? __strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1710,7 +1710,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (free_value && value) free(value); - value = pattern ? strdup(pattern) : pattern; + value = pattern ? __strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1739,7 +1739,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (free_value && value) free(value); - value = pattern ? strdup(pattern) : pattern; + value = pattern ? __strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1763,7 +1763,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, param_length[20] = '\0'; *word = w_addstr(*word, word_length, max_length, - _itoa(value ? strlen(value) : 0, + _itoa(value ? __strlen(value) : 0, ¶m_length[20])); if (free_value) { assert(value != NULL); @@ -1785,7 +1785,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, return *word ? 0 : WRDE_NOSPACE; } else { /* Need to field-split */ - char *value_copy = strdup(value); /* Don't modify value */ + char *value_copy = __strdup(value); /* Don't modify value */ char *field_begin = value_copy; int seen_nonws_ifs = 0; @@ -1825,7 +1825,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Skip at most one non-whitespace IFS character after the field */ seen_nonws_ifs = 0; - if (*next_field && strchr(ifs, *next_field)) { + if (*next_field && __strchr(ifs, *next_field)) { seen_nonws_ifs = 1; next_field++; } @@ -2071,7 +2071,7 @@ int wordexp(const char *words, wordexp_t * we, int flags) if (!ifs) /* IFS unset - use . */ - ifs = strcpy(ifs_white, " \t\n"); + ifs = __strcpy(ifs_white, " \t\n"); else { char *ifsch = ifs; char *whch = ifs_white; @@ -2190,11 +2190,11 @@ int wordexp(const char *words, wordexp_t * we, int flags) default: /* Is it a word separator? */ - if (strchr(" \t", words[words_offset]) == NULL) { + if (__strchr(" \t", words[words_offset]) == NULL) { char ch = words[words_offset]; /* Not a word separator -- but is it a valid word char? */ - if (strchr("\n|&;<>(){}", ch)) { + if (__strchr("\n|&;<>(){}", ch)) { /* Fail */ error = WRDE_BADCHAR; goto do_error; -- cgit v1.2.3