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/stdio/_cs_funcs.c | 6 +++--- libc/stdio/_fopen.c | 2 +- libc/stdio/_fpmaxtostr.c | 2 +- libc/stdio/_fwrite.c | 4 ++-- libc/stdio/_stdio.c | 2 +- libc/stdio/_uintmaxtostr.c | 8 ++++---- libc/stdio/ctermid.c | 2 +- libc/stdio/fmemopen.c | 4 ++-- libc/stdio/fputs.c | 2 +- libc/stdio/fread.c | 2 +- libc/stdio/old_vfprintf.c | 4 ++-- libc/stdio/open_memstream.c | 6 +++--- libc/stdio/popen.c | 12 ++++++------ libc/stdio/scanf.c | 16 ++++++++-------- libc/stdio/tempnam.c | 2 +- libc/stdio/tmpfile.c | 2 +- libc/stdio/tmpnam.c | 2 +- libc/stdio/vfprintf.c | 12 ++++++------ 18 files changed, 45 insertions(+), 45 deletions(-) (limited to 'libc/stdio') diff --git a/libc/stdio/_cs_funcs.c b/libc/stdio/_cs_funcs.c index 9df93f227..3bec64c19 100644 --- a/libc/stdio/_cs_funcs.c +++ b/libc/stdio/_cs_funcs.c @@ -13,14 +13,14 @@ ssize_t attribute_hidden _cs_read(void *cookie, char *buf, size_t bufsize) { - return read(*((int *) cookie), buf, bufsize); + return __read(*((int *) cookie), buf, bufsize); } /**********************************************************************/ ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize) { - return write(*((int *) cookie), (char *) buf, bufsize); + return __write(*((int *) cookie), (char *) buf, bufsize); } /**********************************************************************/ @@ -42,7 +42,7 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence int attribute_hidden _cs_close(void *cookie) { - return close(*((int *) cookie)); + return __close(*((int *) cookie)); } /**********************************************************************/ diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index 8ab314612..e33c50f0a 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -128,7 +128,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode, & O_LARGEFILE) ); } else { __STDIO_WHEN_LFS( if (filedes < -1) open_mode |= O_LARGEFILE ); - if ((stream->__filedes = open(((const char *) fname_or_mode), + if ((stream->__filedes = __open(((const char *) fname_or_mode), open_mode, 0666)) < 0) { goto FREE_STREAM; } diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index 9ffa5493e..2024caca1 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -417,7 +417,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info if (mode == 'f') { round += exp; if (round < -1) { - memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */ + __memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */ exp = -1; round = -1; } diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c index 6657b0849..600b15e6d 100644 --- a/libc/stdio/_fwrite.c +++ b/libc/stdio/_fwrite.c @@ -35,7 +35,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, if (pending > bytes) { pending = bytes; } - memcpy(stream->__bufpos, buffer, pending); + __memcpy(stream->__bufpos, buffer, pending); stream->__bufpos += pending; __STDIO_STREAM_VALIDATE(stream); return bytes; @@ -43,7 +43,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, /* RETRY: */ if (bytes <= __STDIO_STREAM_BUFFER_WAVAIL(stream)) { - memcpy(stream->__bufpos, buffer, bytes); + __memcpy(stream->__bufpos, buffer, bytes); stream->__bufpos += bytes; if (__STDIO_STREAM_IS_LBF(stream) && memrchr(buffer, '\n', bytes) /* Search backwards. */ diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index c71de343d..b5f11419c 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -167,7 +167,7 @@ void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m) static const pthread_mutex_t __stdio_mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer)); + __memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer)); } #endif diff --git a/libc/stdio/_uintmaxtostr.c b/libc/stdio/_uintmaxtostr.c index da7ebc766..847d23560 100644 --- a/libc/stdio/_uintmaxtostr.c +++ b/libc/stdio/_uintmaxtostr.c @@ -61,7 +61,7 @@ char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, u #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, + __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, __UCLIBC_CURLOCALE_DATA.thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since @@ -79,7 +79,7 @@ char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, u #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; - memcpy(bufend, + __memcpy(bufend, (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); } else @@ -104,7 +104,7 @@ char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, u #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, + __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, __UCLIBC_CURLOCALE_DATA.thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since @@ -131,7 +131,7 @@ char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, u #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; - memcpy(bufend, + __memcpy(bufend, (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); } else diff --git a/libc/stdio/ctermid.c b/libc/stdio/ctermid.c index 118608780..11e43f336 100644 --- a/libc/stdio/ctermid.c +++ b/libc/stdio/ctermid.c @@ -21,6 +21,6 @@ char *ctermid(register char *s) return s; #else /* glibc always returns /dev/tty for linux. */ - return strcpy((s ? s : sbuf), "/dev/tty"); + return __strcpy((s ? s : sbuf), "/dev/tty"); #endif } diff --git a/libc/stdio/fmemopen.c b/libc/stdio/fmemopen.c index ff03cb426..7febe1a6e 100644 --- a/libc/stdio/fmemopen.c +++ b/libc/stdio/fmemopen.c @@ -35,7 +35,7 @@ static ssize_t fmo_read(register void *cookie, char *buf, size_t bufsize) bufsize = count; } - memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize); + __memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize); COOKIE->pos += bufsize; return bufsize; @@ -62,7 +62,7 @@ static ssize_t fmo_write(register void *cookie, const char *buf, size_t bufsize) } } - memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c index 4a4d8e480..211fc1018 100644 --- a/libc/stdio/fputs.c +++ b/libc/stdio/fputs.c @@ -17,7 +17,7 @@ int attribute_hidden __fputs_unlocked(register const char * __restrict s, FILE * __restrict stream) { - size_t n = strlen(s); + size_t n = __strlen(s); return ((__fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF); } diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c index 10ae37418..42a29b067 100644 --- a/libc/stdio/fread.c +++ b/libc/stdio/fread.c @@ -44,7 +44,7 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz if (avail > todo) { avail = todo; } - memcpy(buffer, stream->__bufpos, avail); + __memcpy(buffer, stream->__bufpos, avail); buffer += avail; stream->__bufpos += avail; if (!(todo -= avail)) { diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index 97049d379..abf535a16 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -191,7 +191,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n) if (r > n) { r = n; } - memcpy(f->bufpos, s, r); + __memcpy(f->bufpos, s, r); f->bufpos += r; } } @@ -237,7 +237,7 @@ static void _charpad(FILE * __restrict stream, int padchar, size_t numpad) static void _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) { if (type & 0x80) { /* Some type of padding needed. */ - int buflen = strlen((const char *) buf); + int buflen = __strlen((const char *) buf); if ((len -= buflen) > 0) { _charpad(fp, (type & 0x7f), len); } diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c index 0e3df43d1..358486010 100644 --- a/libc/stdio/open_memstream.c +++ b/libc/stdio/open_memstream.c @@ -51,7 +51,7 @@ static ssize_t oms_write(register void *cookie, const char *buf, size_t bufsize) } } - memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { @@ -90,7 +90,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) if (buf) { *COOKIE->bufloc = COOKIE->buf = buf; COOKIE->len = leastlen; - memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ + __memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ } else { /* TODO: check glibc errno setting... */ return -1; @@ -100,7 +100,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) *pos = COOKIE->pos = --leastlen; if (leastlen > COOKIE->eof) { - memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); + __memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); *COOKIE->sizeloc = COOKIE->eof; } diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index c7887ad41..6de09253c 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -84,23 +84,23 @@ FILE *popen(const char *command, const char *modes) parent_fd = pipe_fd[1-child_writing]; if (!(fp = fdopen(parent_fd, modes))) { - close(parent_fd); - close(child_fd); + __close(parent_fd); + __close(child_fd); goto FREE_PI; } VFORK_LOCK; if ((pid = vfork()) == 0) { /* Child of vfork... */ - close(parent_fd); + __close(parent_fd); if (child_fd != child_writing) { dup2(child_fd, child_writing); - close(child_fd); + __close(child_fd); } /* SUSv3 requires that any previously popen()'d streams in the * parent shall be closed in the child. */ for (po = popen_list ; po ; po = po->next) { - close(po->f->__filedes); + __close(po->f->__filedes); } execl("/bin/sh", "sh", "-c", command, (char *)0); @@ -113,7 +113,7 @@ FILE *popen(const char *command, const char *modes) /* We need to close the child filedes whether vfork failed or * it succeeded and we're in the parent. */ - close(child_fd); + __close(child_fd); if (pid > 0) { /* Parent of vfork... */ pi->pid = pid; diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index ed424f163..af1018636 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -246,7 +246,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) f.__bufstart = f.__bufpos = (unsigned char *) ((void *) sp); f.__bufread = - f.__bufend = f.__bufstart + strlen(sp); + f.__bufend = f.__bufstart + __strlen(sp); __STDIO_STREAM_ENABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); @@ -260,7 +260,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) __FILE_vsscanf f; f.bufpos = (unsigned char *) ((void *) sp); - f.bufread = f.bufpos + strlen(sp); + f.bufread = f.bufpos + __strlen(sp); /* __STDIO_STREAM_RESET_GCS(&f.f); */ #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ @@ -298,7 +298,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) FILE *f; int rv = EOF; - if ((f = fmemopen((char *)sp, strlen(sp), "r")) != NULL) { + if ((f = fmemopen((char *)sp, __strlen(sp), "r")) != NULL) { rv = vfscanf(f, fmt, ap); fclose(f); } @@ -1188,7 +1188,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) #if defined(NL_ARGMAX) && (NL_ARGMAX > 0) psfs.num_pos_args = -1; /* Must start at -1. */ /* Initialize positional arg ptrs to NULL. */ - memset(psfs.pos_args, 0, sizeof(psfs.pos_args)); + __memset(psfs.pos_args, 0, sizeof(psfs.pos_args)); #endif /* defined(NL_ARGMAX) && (NL_ARGMAX > 0) */ __STDIO_AUTO_THREADLOCK(fp); @@ -1420,7 +1420,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) ++fmt; invert = 1; } - memset(scanset, invert, sizeof(scanset)); + __memset(scanset, invert, sizeof(scanset)); invert = 1-invert; if (*fmt == ']') { @@ -1969,14 +1969,14 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) if ((psfs->conv_num > CONV_i) /* float conversion */ && (!pass || (i == nblk1)) /* possible last */ - && !memcmp(sc->thousands_sep, sc->fake_decpt, k) + && !__memcmp(sc->thousands_sep, sc->fake_decpt, k) /* and prefix matched, so could be decpt */ ) { __scan_getc(sc); p = sc->fake_decpt + k; do { if (!*++p) { - strcpy(b, sc->decpt); + __strcpy(b, sc->decpt); b += sc->decpt_len; goto GOT_DECPT; } @@ -2070,7 +2070,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) p = sc->fake_decpt; do { if (!*p) { - strcpy(b, sc->decpt); + __strcpy(b, sc->decpt); b += sc->decpt_len; break; } diff --git a/libc/stdio/tempnam.c b/libc/stdio/tempnam.c index a11f82b5d..d626dc0f8 100644 --- a/libc/stdio/tempnam.c +++ b/libc/stdio/tempnam.c @@ -38,6 +38,6 @@ tempnam (const char *dir, const char *pfx) if (__gen_tempname (buf, __GT_NOCREATE)) return NULL; - return strdup (buf); + return __strdup (buf); } diff --git a/libc/stdio/tmpfile.c b/libc/stdio/tmpfile.c index 5484d5d6c..488ddd763 100644 --- a/libc/stdio/tmpfile.c +++ b/libc/stdio/tmpfile.c @@ -42,7 +42,7 @@ FILE * tmpfile (void) (void) remove (buf); if ((f = fdopen (fd, "w+b")) == NULL) - close (fd); + __close (fd); return f; } diff --git a/libc/stdio/tmpnam.c b/libc/stdio/tmpnam.c index 802c54498..df2399e66 100644 --- a/libc/stdio/tmpnam.c +++ b/libc/stdio/tmpnam.c @@ -41,7 +41,7 @@ char * tmpnam (char *s) return NULL; if (s == NULL) - return (char *) memcpy (tmpnam_buffer, tmpbuf, L_tmpnam); + return (char *) __memcpy (tmpnam_buffer, tmpbuf, L_tmpnam); return s; } diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index 0852c9915..4675dacc2 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -508,7 +508,7 @@ int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0) int r; /* First, zero out everything... argnumber[], argtype[], argptr[] */ - memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ + __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ #ifdef NL_ARGMAX --ppfs->maxposarg; /* set to -1 */ #endif /* NL_ARGMAX */ @@ -1114,7 +1114,7 @@ int attribute_hidden _ppfs_parsespec(ppfs_t *ppfs) } else { #endif /* NL_ARGMAX */ ppfs->argnumber[2] = 1; - memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int)); + __memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int)); #ifdef NL_ARGMAX } @@ -1197,7 +1197,7 @@ static size_t _charpad(FILE * __restrict stream, int padchar, size_t numpad); #define VFPRINTF vfprintf #define FMT_TYPE char #define OUTNSTR _outnstr -#define STRLEN strlen +#define STRLEN __strlen #define _PPFS_init _ppfs_init #define OUTPUT(F,S) __fputs_unlocked(S,F) /* #define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream) */ @@ -1211,7 +1211,7 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf size_t r = 0; if (type & 0x80) { /* Some type of padding needed. */ - int buflen = strlen((const char *) buf); + int buflen = __strlen((const char *) buf); if ((len -= buflen) > 0) { if ((r = _charpad(fp, (type & 0x7f), len)) != len) { return r; @@ -1281,7 +1281,7 @@ static size_t _fp_out_wide(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) int i; if (type & 0x80) { /* Some type of padding needed */ - int buflen = strlen(s); + int buflen = __strlen(s); if ((len -= buflen) > 0) { if ((r = _charpad(fp, (type & 0x7f), len)) != len) { return r; @@ -1325,7 +1325,7 @@ static int _ppwfs_init(register ppfs_t *ppfs, const wchar_t *fmt0) int r; /* First, zero out everything... argnumber[], argtype[], argptr[] */ - memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ + __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ #ifdef NL_ARGMAX --ppfs->maxposarg; /* set to -1 */ #endif /* NL_ARGMAX */ -- cgit v1.2.3