]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
libio: Assume _LIBC, weak_alias, errno, (__set_)errno &c are defined
authorFlorian Weimer <fweimer@redhat.com>
Thu, 31 Aug 2017 12:07:23 +0000 (14:07 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 31 Aug 2017 12:48:25 +0000 (14:48 +0200)
Do not define _POSIX_SOURCE.

48 files changed:
ChangeLog
libio/fcloseall.c
libio/feof.c
libio/ferror.c
libio/fileno.c
libio/fileops.c
libio/ftello.c
libio/ftello64.c
libio/genops.c
libio/getc.c
libio/getwc.c
libio/iofclose.c
libio/iofdopen.c
libio/iofflush.c
libio/iofgetpos.c
libio/iofgetpos64.c
libio/iofgets.c
libio/iofopen.c
libio/iofopen64.c
libio/iofputs.c
libio/iofread.c
libio/iofsetpos.c
libio/iofsetpos64.c
libio/ioftell.c
libio/iofwide.c
libio/iofwrite.c
libio/iogetdelim.c
libio/iogets.c
libio/iogetwline.c
libio/iopopen.c
libio/ioputs.c
libio/ioseekoff.c
libio/iosetbuffer.c
libio/iosetvbuf.c
libio/ioungetc.c
libio/libioP.h
libio/oldfileops.c
libio/oldiofdopen.c
libio/oldiofgetpos.c
libio/oldiofgetpos64.c
libio/oldiofsetpos.c
libio/oldiofsetpos64.c
libio/oldiopopen.c
libio/putc.c
libio/stdfiles.c
libio/stdio.c
libio/wfileops.c
libio/wgenops.c

index c94f4c1639c49b0f08eb80c143c6e9ea8bfa3fdd..f9625dec803f50a00f946d274674bba435875413 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,96 @@
+2017-08-31  Florian Weimer  <fweimer@redhat.com>
+
+       * libio/fcloseall.c: Assume weak_alias is defined.
+       * libio/feof.c: Likewise.
+       * libio/fileno.c: Likewise.
+       * libio/fileops.c: Assume _LIBC, errno, __set_errno are defined.
+       (_POSIX_SOURCE, open, lseek, read, write): Remove macro
+       definitions.
+       (_IO_file_open): Call __open directly.
+       (_IO_new_file_sync): Assume ESPIPE is defined.
+       (_IO_file_seekoff_maybe_mmap): Call __read directly.
+       (_IO_new_file_write): Call __write directly.
+       * libio/ftello.c (__ftello): Assume EIO, EOVERFLOW are defined.
+       * libio/ftello64.c (__ftello64): Assume EIO is defined.
+       * libio/genops.c: Assume _LIBC is defined.
+       (save_for_backup): Remove internal_function.
+       * libio/getc.c: Assume weak_alias is defined.
+       * libio/getwc.c: Likewise.
+       * libio/iofclose.c: Assume _LIBC is defined.
+       * libio/iofdopen.c: Likewise.
+       (_IO_fcntl): Remove macro definition.
+       (_IO_new_fdopen): Assume F_GETFL, F_SETFL, O_ACCMODE are defined.
+       Call __fcntl directly.
+       * libio/iofflush.c: Assume weak_alias is defined.
+       * libio/iofgetpos.c (_IO_new_fgetpos): Assume EIO, EOVERFLOW are
+       defined.
+       * libio/iofgetpos64.c (_IO_new_fgetpos64): Assume EIO is defined.
+       * libio/iofgets.c: Likewise.
+       * libio/iofopen.c: Assume _LIBC is defined.
+       * libio/iofopen64.c: Assume _LIBC, weak_alias are defined.
+       * libio/iofputs.c: Assume weak_alias is defined.
+       * libio/iofread.c: Likewise.
+       * libio/iofsetpos.c (_IO_new_fsetpos): Assume EIO is defined.
+       * libio/iofsetpos64.c (_IO_new_fsetpos64): Likewise.
+       * libio/ioftell.c: Assume weak_alias is defined.
+       (_IO_ftell): Assume EIO, EOVERFLOW are defined.
+       * libio/iofwide.c: Assume _LIBC is defined.
+       (_IO_fwide): Drop SHARED conditional because it is implied by
+       SHLIB_COMPAT.
+       * libio/iofwrite.c: Assume weak_alias is defined.
+       * libio/iogetdelim.c: Likewise.
+       * libio/iogets.c: Assume _LIBC, weak_alias are defined.
+       * libio/iogetwline.c (wmemcpy): Remove macro definition.
+       (_IO_getwline): Call __wmemcpy directly.
+       * libio/iopopen.c: Assume _LIBC is defined.
+       (_POSIX_SOURCE, _IO_fork, _IO_dup2, _IO_waitpid, _IO_execl)
+       (_IO_close): Remove macro definitions.
+       (_IO_new_proc_open): Call __fork, __dup2, __close_nocancel, execl,
+       _exit directly.
+       (_IO_new_proc_close): Call __close_nocancel, __waitpid_nocancel
+       directly.
+       * libio/ioputs.c: Assume weak_alias is defined.
+       * libio/ioseekoff.c: Assume errno, __set_errno are defined.
+       * libio/iosetbuffer.c: Assume weak_alias is defined.
+       * libio/iosetvbuf.c: Likewise.
+       * libio/ioungetc.c: Likewise.
+       * libio/libioP.h: Assume _LIBC, __GLIBC__, libc_hidden_proto,
+       libc_hidden_def, libc_hidden_weak, NULL are defined.
+       (mmap, munmap, ftruncate, OS_FSTAT): Remove macro definitions.
+       * libio/oldfilepos.c: Assume _LIBC, errno, __set_errno are
+       defined.
+       (_POSIX_SOURCE, open, lseek, read, write): Remove macro
+       definitions.
+       (_IO_old_file_init_internal): Drop SHARED conditional because it
+       is implied by SHLIB_COMPAT.
+       (_IO_old_file_fopen): Call __open directly.
+       (_IO_old_file_sync): Assume ESPIPE is defined.
+       (_IO_old_file_write): Call __write directly.
+       * libio/oldfdopen.c (_IO_fcntl): Remove macro definition.
+       (_IO_old_fdopen): Assume F_GETFL, O_ACCMODE, F_SETFL are defined.
+       Call __fcntl directly.
+       * libio/oldiofgetpos.c: Assume weak_alias is defined.
+       (_IO_old_fgetpos): Assume EIO is defined.
+       * libio/oldiofgetpos64.c: Assume weak_alias is defined.
+       (_IO_old_fgetpos64): Assume EIO is defined.
+       * libio/oldiofsetpos.c: Assume weak_alias is defined.
+       (_IO_old_fsetpos): Assume EIO is defined.
+       * libio/oldiofsetpos64.c: Assume weak_alias is defined.
+       (_IO_old_fsetpos64): Assume EIO is defined.
+       * libio/oldiopopen.c:  Assume _LIBC is defined.
+       (_POSIX_SOURCE, _IO_fork, _IO_dup2, _IO_waitpid, _IO_execl)
+       (_IO_close): Remove macro definitions.
+       (_IO_old_proc_open): Call __pipe, __close, __dup2, execl, _exit
+       directly.
+       (_IO_old_proc_close): Call __close, __waitpid directly.
+       * libio/put.c: Assume weak_alias is defined.
+       * libio/stdfiles.c: Assume _LIBC is defined.
+       * libio/stdio.c: Likewise.
+       * libio/wfileops.c: Likewise.
+       (_IO_wfile_sync): Assume ESPIPE is defined.
+       * libio/wgenops.c: Assume _LIBC is defined.
+       (save_for_wbackup): Remove internal_function.
+
 2017-08-31  Florian Weimer  <fweimer@redhat.com>
 
        * malloc/malloc.c (top_check): Change return type to void.  Remove
index 59c33ccf48ee9c8c81436e14112bb89b9b303988..80e1ae01d7647db4ccc48d308a59a1801f74d57c 100644 (file)
@@ -34,6 +34,4 @@ __fcloseall (void)
   return _IO_cleanup ();
 }
 
-#ifdef weak_alias
 weak_alias (__fcloseall, fcloseall)
-#endif
index 8890a5f51fe9ad4d440802a4a6992758ddf7b2f2..72dde1f82da92cfdb46ac52fb7ed40d626a46a5e 100644 (file)
@@ -40,11 +40,9 @@ _IO_feof (_IO_FILE *fp)
   return result;
 }
 
-#ifdef weak_alias
 weak_alias (_IO_feof, feof)
 
 #ifndef _IO_MTSAFE_IO
 #undef feof_unlocked
 weak_alias (_IO_feof, feof_unlocked)
 #endif
-#endif
index d10fcd9fff2d12334d6d5ec434cfa4acc2d796f9..ab6185badea14c9205ac17eb47d441c1763f1a74 100644 (file)
@@ -40,11 +40,9 @@ _IO_ferror (_IO_FILE *fp)
   return result;
 }
 
-#ifdef weak_alias
 weak_alias (_IO_ferror, ferror)
 
 #ifndef _IO_MTSAFE_IO
 #undef ferror_unlocked
 weak_alias (_IO_ferror, ferror_unlocked)
 #endif
-#endif
index b78d4a14612e0da1b8f71d8b983097ba927558b9..d4d749d4d033bf609ca934c52b3b8aa40fa8beda 100644 (file)
@@ -44,10 +44,8 @@ libc_hidden_def (__fileno)
 weak_alias (__fileno, fileno)
 libc_hidden_weak (fileno)
 
-#ifdef weak_alias
 /* The fileno implementation for libio does not require locking because
    it only accesses once a single variable and this is already atomic
    (at least at thread level).  Therefore we don't test _IO_MTSAFE_IO here.  */
 
 weak_alias (__fileno, fileno_unlocked)
-#endif
index b8b02ba2613ca64c35c0e481b1dc3bdc5567b6ae..a9e948f31e655a791f577f09858e65696f469c92 100644 (file)
@@ -26,9 +26,6 @@
    in files containing the exception.  */
 
 
-#ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
 #include "libioP.h"
 #include <assert.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
-#if _LIBC
-# include "../wcsmbs/wcsmbsload.h"
-# include "../iconv/gconv_charset.h"
-# include "../iconv/gconv_int.h"
-# include <shlib-compat.h>
-# include <not-cancel.h>
-# include <kernel-features.h>
-#endif
-#ifndef errno
-extern int errno;
-#endif
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-
-
-#ifdef _LIBC
-# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
-# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
-# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
-# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
-#else
-# define _IO_new_do_write _IO_do_write
-# define _IO_new_file_attach _IO_file_attach
-# define _IO_new_file_close_it _IO_file_close_it
-# define _IO_new_file_finish _IO_file_finish
-# define _IO_new_file_fopen _IO_file_fopen
-# define _IO_new_file_init _IO_file_init
-# define _IO_new_file_setbuf _IO_file_setbuf
-# define _IO_new_file_sync _IO_file_sync
-# define _IO_new_file_overflow _IO_file_overflow
-# define _IO_new_file_seekoff _IO_file_seekoff
-# define _IO_new_file_underflow _IO_file_underflow
-# define _IO_new_file_write _IO_file_write
-# define _IO_new_file_xsputn _IO_file_xsputn
-#endif
+#include "../wcsmbs/wcsmbsload.h"
+#include "../iconv/gconv_charset.h"
+#include "../iconv/gconv_int.h"
+#include <shlib-compat.h>
+#include <not-cancel.h>
+#include <kernel-features.h>
 
-
-#ifdef _LIBC
 extern struct __gconv_trans_data __libio_translit attribute_hidden;
-#endif
-
 
 /* An fstream can be in at most one of put mode, get mode, or putback mode.
    Putback mode is a variant of get mode.
@@ -180,7 +143,6 @@ _IO_new_file_close_it (_IO_FILE *fp)
                      ? _IO_SYSCLOSE (fp) : 0);
 
   /* Free buffer. */
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
   if (fp->_mode > 0)
     {
       if (_IO_have_wbackup (fp))
@@ -189,7 +151,6 @@ _IO_new_file_close_it (_IO_FILE *fp)
       _IO_wsetg (fp, NULL, NULL, NULL);
       _IO_wsetp (fp, NULL, NULL);
     }
-#endif
   _IO_setb (fp, NULL, NULL, 0);
   _IO_setg (fp, NULL, NULL, NULL);
   _IO_setp (fp, NULL, NULL);
@@ -221,15 +182,11 @@ _IO_file_open (_IO_FILE *fp, const char *filename, int posix_mode, int prot,
               int read_write, int is32not64)
 {
   int fdesc;
-#ifdef _LIBC
   if (__glibc_unlikely (fp->_flags2 & _IO_FLAGS2_NOTCANCEL))
     fdesc = __open_nocancel (filename,
                             posix_mode | (is32not64 ? 0 : O_LARGEFILE), prot);
   else
-    fdesc = open (filename, posix_mode | (is32not64 ? 0 : O_LARGEFILE), prot);
-#else
-  fdesc = open (filename, posix_mode, prot);
-#endif
+    fdesc = __open (filename, posix_mode | (is32not64 ? 0 : O_LARGEFILE), prot);
   if (fdesc < 0)
     return NULL;
   fp->_fileno = fdesc;
@@ -260,10 +217,8 @@ _IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
   int oprot = 0666;
   int i;
   _IO_FILE *result;
-#ifdef _LIBC
   const char *cs;
   const char *last_recognized;
-#endif
 
   if (_IO_file_is_open (fp))
     return 0;
@@ -287,9 +242,7 @@ _IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
       __set_errno (EINVAL);
       return NULL;
     }
-#ifdef _LIBC
   last_recognized = mode;
-#endif
   for (i = 1; i < 7; ++i)
     {
       switch (*++mode)
@@ -299,20 +252,14 @@ _IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
        case '+':
          omode = O_RDWR;
          read_write &= _IO_IS_APPENDING;
-#ifdef _LIBC
          last_recognized = mode;
-#endif
          continue;
        case 'x':
          oflags |= O_EXCL;
-#ifdef _LIBC
          last_recognized = mode;
-#endif
          continue;
        case 'b':
-#ifdef _LIBC
          last_recognized = mode;
-#endif
          continue;
        case 'm':
          fp->_flags2 |= _IO_FLAGS2_MMAP;
@@ -874,10 +821,8 @@ _IO_new_file_sync (_IO_FILE *fp)
       _IO_off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
       if (new_pos != (_IO_off64_t) EOF)
        fp->_IO_read_end = fp->_IO_read_ptr;
-#ifdef ESPIPE
       else if (errno == ESPIPE)
        ; /* Ignore error from unseekable devices. */
-#endif
       else
        retval = EOF;
     }
@@ -1205,7 +1150,7 @@ _IO_file_read (_IO_FILE *fp, void *buf, _IO_ssize_t size)
 {
   return (__builtin_expect (fp->_flags2 & _IO_FLAGS2_NOTCANCEL, 0)
          ? __read_nocancel (fp->_fileno, buf, size)
-         : read (fp->_fileno, buf, size));
+         : __read (fp->_fileno, buf, size));
 }
 libc_hidden_def (_IO_file_read)
 
@@ -1252,7 +1197,7 @@ _IO_new_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
       _IO_ssize_t count = (__builtin_expect (f->_flags2
                                             & _IO_FLAGS2_NOTCANCEL, 0)
                           ? __write_nocancel (f->_fileno, data, to_do)
-                          : write (f->_fileno, data, to_do));
+                          : __write (f->_fileno, data, to_do));
       if (count < 0)
        {
          f->_flags |= _IO_ERR_SEEN;
@@ -1307,12 +1252,7 @@ _IO_new_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
     {
       if (count > to_do)
        count = to_do;
-#ifdef _LIBC
       f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
-#else
-      memcpy (f->_IO_write_ptr, s, count);
-      f->_IO_write_ptr += count;
-#endif
       s += count;
       to_do -= count;
     }
@@ -1380,12 +1320,7 @@ _IO_file_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
        {
          if (have > 0)
            {
-#ifdef _LIBC
              s = __mempcpy (s, fp->_IO_read_ptr, have);
-#else
-             memcpy (s, fp->_IO_read_ptr, have);
-             s += have;
-#endif
              want -= have;
              fp->_IO_read_ptr += have;
            }
@@ -1458,12 +1393,7 @@ _IO_file_xsgetn_mmap (_IO_FILE *fp, void *data, _IO_size_t n)
     {
       if (__glibc_unlikely (_IO_in_backup (fp)))
        {
-#ifdef _LIBC
          s = __mempcpy (s, read_ptr, have);
-#else
-         memcpy (s, read_ptr, have);
-         s += have;
-#endif
          n -= have;
          _IO_switch_to_main_get_area (fp);
          read_ptr = fp->_IO_read_ptr;
@@ -1488,12 +1418,7 @@ _IO_file_xsgetn_mmap (_IO_FILE *fp, void *data, _IO_size_t n)
   if (have != 0)
     {
       have = MIN (have, n);
-#ifdef _LIBC
       s = __mempcpy (s, read_ptr, have);
-#else
-      memcpy (s, read_ptr, have);
-      s += have;
-#endif
       fp->_IO_read_ptr = read_ptr + have;
     }
 
@@ -1510,7 +1435,6 @@ _IO_file_xsgetn_maybe_mmap (_IO_FILE *fp, void *data, _IO_size_t n)
   return _IO_XSGETN (fp, data, n);
 }
 
-#ifdef _LIBC
 versioned_symbol (libc, _IO_new_do_write, _IO_do_write, GLIBC_2_1);
 versioned_symbol (libc, _IO_new_file_attach, _IO_file_attach, GLIBC_2_1);
 versioned_symbol (libc, _IO_new_file_close_it, _IO_file_close_it, GLIBC_2_1);
@@ -1524,7 +1448,6 @@ versioned_symbol (libc, _IO_new_file_seekoff, _IO_file_seekoff, GLIBC_2_1);
 versioned_symbol (libc, _IO_new_file_underflow, _IO_file_underflow, GLIBC_2_1);
 versioned_symbol (libc, _IO_new_file_write, _IO_file_write, GLIBC_2_1);
 versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
-#endif
 
 const struct _IO_jump_t _IO_file_jumps libio_vtable =
 {
index 38863e16c3067661b6be22ee87076c7c60c3acf2..9791e835c6ada89a5d59ee8a0d6616f051a91e27 100644 (file)
@@ -45,17 +45,13 @@ __ftello (_IO_FILE *fp)
   _IO_release_lock (fp);
   if (pos == _IO_pos_BAD)
     {
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       return -1L;
     }
   if ((_IO_off64_t) (off_t) pos != pos)
     {
-#ifdef EOVERFLOW
       __set_errno (EOVERFLOW);
-#endif
       return -1L;
     }
   return pos;
index edb10e088090130607cb7827a96fc0f074867283..15518af7a6e6a85e3de76a85277ff6ac0228055a 100644 (file)
@@ -46,10 +46,8 @@ ftello64 (_IO_FILE *fp)
   _IO_release_lock (fp);
   if (pos == _IO_pos_BAD)
     {
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       return -1L;
     }
   return pos;
index 6ad7346cae5c169d638dabac86291447ef666386..e3f372520a35e9bd349d7cab94bb2ed68d8e44dd 100644 (file)
@@ -30,9 +30,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdbool.h>
-#ifdef _LIBC
 #include <sched.h>
-#endif
 
 #ifdef _IO_MTSAFE_IO
 static _IO_lock_t list_all_lock = _IO_lock_initializer;
@@ -233,16 +231,7 @@ __overflow (_IO_FILE *f, int ch)
 }
 libc_hidden_def (__overflow)
 
-static int save_for_backup (_IO_FILE *fp, char *end_p)
-#ifdef _LIBC
-     internal_function
-#endif
-     ;
-
 static int
-#ifdef _LIBC
-internal_function
-#endif
 save_for_backup (_IO_FILE *fp, char *end_p)
 {
   /* Append [_IO_read_base..end_p] to backup area. */
@@ -263,20 +252,11 @@ save_for_backup (_IO_FILE *fp, char *end_p)
        return EOF;             /* FIXME */
       if (least_mark < 0)
        {
-#ifdef _LIBC
          __mempcpy (__mempcpy (new_buffer + avail,
                                fp->_IO_save_end + least_mark,
                                -least_mark),
                     fp->_IO_read_base,
                     end_p - fp->_IO_read_base);
-#else
-         memcpy (new_buffer + avail,
-                 fp->_IO_save_end + least_mark,
-                 -least_mark);
-         memcpy (new_buffer + avail - least_mark,
-                 fp->_IO_read_base,
-                 end_p - fp->_IO_read_base);
-#endif
        }
       else
        memcpy (new_buffer + avail,
@@ -314,10 +294,8 @@ save_for_backup (_IO_FILE *fp, char *end_p)
 int
 __underflow (_IO_FILE *fp)
 {
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
   if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
-#endif
 
   if (fp->_mode == 0)
     _IO_fwide (fp, -1);
@@ -346,10 +324,8 @@ libc_hidden_def (__underflow)
 int
 __uflow (_IO_FILE *fp)
 {
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
   if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
-#endif
 
   if (fp->_mode == 0)
     _IO_fwide (fp, -1);
@@ -434,12 +410,7 @@ _IO_default_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
            count = more;
          if (count > 20)
            {
-#ifdef _LIBC
              f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
-#else
-             memcpy (f->_IO_write_ptr, s, count);
-             f->_IO_write_ptr += count;
-#endif
              s += count;
            }
          else if (count)
@@ -483,12 +454,7 @@ _IO_default_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
            count = more;
          if (count > 20)
            {
-#ifdef _LIBC
              s = __mempcpy (s, fp->_IO_read_ptr, count);
-#else
-             memcpy (s, fp->_IO_read_ptr, count);
-             s += count;
-#endif
              fp->_IO_read_ptr += count;
            }
          else if (count)
@@ -633,7 +599,6 @@ _IO_no_init (_IO_FILE *fp, int flags, int orientation,
 {
   _IO_old_init (fp, flags);
   fp->_mode = orientation;
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
   if (orientation >= 0)
     {
       fp->_wide_data = wd;
@@ -655,7 +620,6 @@ _IO_no_init (_IO_FILE *fp, int flags, int orientation,
     /* Cause predictable crash when a wide function is called on a byte
        stream.  */
     fp->_wide_data = (struct _IO_wide_data *) -1L;
-#endif
   fp->_freeres_list = NULL;
 }
 
@@ -811,11 +775,9 @@ _IO_flush_all_lockp (int do_lock)
        _IO_flockfile (fp);
 
       if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base)
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
           || (_IO_vtable_offset (fp) == 0
               && fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr
                                    > fp->_wide_data->_IO_write_base))
-#endif
           )
          && _IO_OVERFLOW (fp, EOF) == EOF)
        result = EOF;
@@ -892,9 +854,7 @@ _IO_flush_all_linebuffered (void)
 #endif
 }
 libc_hidden_def (_IO_flush_all_linebuffered)
-#ifdef _LIBC
 weak_alias (_IO_flush_all_linebuffered, _flushlbf)
-#endif
 
 
 /* The following is a bit tricky.  In general, we want to unbuffer the
index fd66ef93cf49beb8a37da7184d914b6091d5dac6..2df0fcc983c3578ca028922f7f67c831cb93f967 100644 (file)
@@ -44,7 +44,6 @@ _IO_getc (FILE *fp)
 
 #undef getc
 
-#ifdef weak_alias
 weak_alias (_IO_getc, getc)
 weak_alias (_IO_getc, fgetc)
 
@@ -53,4 +52,3 @@ weak_alias (_IO_getc, fgetc)
 weak_alias (_IO_getc, getc_unlocked)
 weak_alias (_IO_getc, fgetc_unlocked)
 #endif
-#endif
index 9959aab2f02d81d9c5e8e77dbc2f9cfaec7993f7..fbc2bb1ab7b78769fab0fecd5c106c57d229231e 100644 (file)
@@ -43,7 +43,5 @@ _IO_getwc (FILE *fp)
 
 #undef getwc
 
-#ifdef weak_alias
 weak_alias (_IO_getwc, getwc)
 weak_alias (_IO_getwc, fgetwc)
-#endif
index 9c51c4efd2ea3bf935f1bd03b63ac087f7e34da9..f5dc3db2a377fa2979c0f18f1166b2a74fa28a09 100644 (file)
 
 #include "libioP.h"
 #include <stdlib.h>
-#if _LIBC
-# include "../iconv/gconv_int.h"
-# include <shlib-compat.h>
-#else
-# define SHLIB_COMPAT(a, b, c) 0
-# define _IO_new_fclose fclose
-#endif
+#include "../iconv/gconv_int.h"
+#include <shlib-compat.h>
 
 int
 _IO_new_fclose (_IO_FILE *fp)
@@ -62,7 +57,6 @@ _IO_new_fclose (_IO_FILE *fp)
   _IO_FINISH (fp);
   if (fp->_mode > 0)
     {
-#if _LIBC
       /* This stream has a wide orientation.  This means we have to free
         the conversion functions.  */
       struct _IO_codecvt *cc = fp->_codecvt;
@@ -71,7 +65,6 @@ _IO_new_fclose (_IO_FILE *fp)
       __gconv_release_step (cc->__cd_in.__cd.__steps);
       __gconv_release_step (cc->__cd_out.__cd.__steps);
       __libc_lock_unlock (__gconv_lock);
-#endif
     }
   else
     {
@@ -87,8 +80,6 @@ _IO_new_fclose (_IO_FILE *fp)
   return status;
 }
 
-#ifdef _LIBC
 versioned_symbol (libc, _IO_new_fclose, _IO_fclose, GLIBC_2_1);
 strong_alias (_IO_new_fclose, __new_fclose)
 versioned_symbol (libc, __new_fclose, fclose, GLIBC_2_1);
-#endif
index 2a1df4680a29d83c33873639bd1ea02d32cb1874..90346a4ece18f29175df01953fc4f14557e5320d 100644 (file)
 #include "libioP.h"
 #include <fcntl.h>
 
-#ifdef _LIBC
-# include <shlib-compat.h>
-#endif
-
-#ifndef _IO_fcntl
-#ifdef _LIBC
-#define _IO_fcntl __fcntl
-#else
-#define _IO_fcntl fcntl
-#endif
-#endif
+#include <shlib-compat.h>
 
 _IO_FILE *
 _IO_new_fdopen (int fd, const char *mode)
@@ -95,11 +85,7 @@ _IO_new_fdopen (int fd, const char *mode)
        }
       break;
     }
-#ifdef F_GETFL
-  int fd_flags = _IO_fcntl (fd, F_GETFL);
-#ifndef O_ACCMODE
-#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-#endif
+  int fd_flags = __fcntl (fd, F_GETFL);
   if (fd_flags == -1)
     return NULL;
 
@@ -129,12 +115,9 @@ _IO_new_fdopen (int fd, const char *mode)
   if ((read_write & _IO_IS_APPENDING) && !(fd_flags & O_APPEND))
     {
       do_seek = true;
-#ifdef F_SETFL
-      if (_IO_fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1)
-#endif
+      if (__fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1)
        return NULL;
     }
-#endif
 
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
index c6b1f1594606b4abbd7d47c98766fad58df5c56e..b312fd23ab9083c796b836eb5267ab72bc3fad8a 100644 (file)
@@ -44,7 +44,6 @@ _IO_fflush (_IO_FILE *fp)
 }
 libc_hidden_def (_IO_fflush)
 
-#ifdef weak_alias
 weak_alias (_IO_fflush, fflush)
 libc_hidden_weak (fflush)
 
@@ -54,4 +53,3 @@ libc_hidden_def (__fflush_unlocked)
 weak_alias (_IO_fflush, fflush_unlocked)
 libc_hidden_weak (fflush_unlocked)
 #endif
-#endif
index c1330dee29b0d8fbfe6c47dc35a04dd71eed143a..f3034528f14e38bfa3a752bee6b4aede3b78edf1 100644 (file)
@@ -56,17 +56,13 @@ _IO_new_fgetpos (_IO_FILE *fp, _IO_fpos_t *posp)
     {
       /* ANSI explicitly requires setting errno to a positive value on
         failure.  */
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       result = EOF;
     }
   else if ((_IO_off64_t) (__typeof (posp->__pos)) pos != pos)
     {
-#ifdef EOVERFLOW
       __set_errno (EOVERFLOW);
-#endif
       result = EOF;
     }
   else
index 340dded802f7e8c8a3355e870789ff52fc7159a2..e9c464d108dd4348e811203efbec5f45e1f254df 100644 (file)
@@ -47,10 +47,8 @@ _IO_new_fgetpos64 (_IO_FILE *fp, _IO_fpos64_t *posp)
     {
       /* ANSI explicitly requires setting errno to a positive value on
         failure.  */
-# ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-# endif
       result = EOF;
     }
   else
index 8643e7c6cc7c0ddb9f662eb1f0b850149338196e..232d28ef81cc605437831e586b9b3396b6a6565d 100644 (file)
@@ -66,7 +66,6 @@ _IO_fgets (char *buf, int n, _IO_FILE *fp)
   return result;
 }
 
-#ifdef weak_alias
 weak_alias (_IO_fgets, fgets)
 
 # ifndef _IO_MTSAFE_IO
@@ -75,4 +74,3 @@ libc_hidden_def (__fgets_unlocked)
 weak_alias (_IO_fgets, fgets_unlocked)
 libc_hidden_weak (fgets_unlocked)
 # endif
-#endif
index 3d30dfd94a9a5dc34101ed922321a28413534d74..62d03329946660f737bc68569e80ec354dddc582 100644 (file)
 #include <fcntl.h>
 #include <stdlib.h>
 #include <stddef.h>
-#ifdef _LIBC
-# include <shlib-compat.h>
-#else
-# define _IO_new_fopen fopen
-#endif
+#include <shlib-compat.h>
 
 _IO_FILE *
 __fopen_maybe_mmap (_IO_FILE *fp)
@@ -73,11 +69,7 @@ __fopen_internal (const char *filename, const char *mode, int is32)
 #ifdef _IO_MTSAFE_IO
   new_f->fp.file._lock = &new_f->lock;
 #endif
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
   _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
-#else
-  _IO_no_init (&new_f->fp.file, 1, 0, NULL, NULL);
-#endif
   _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
   _IO_new_file_init_internal (&new_f->fp);
 #if  !_IO_UNIFIED_JUMPTABLES
@@ -97,7 +89,6 @@ _IO_new_fopen (const char *filename, const char *mode)
   return __fopen_internal (filename, mode, 1);
 }
 
-#ifdef _LIBC
 strong_alias (_IO_new_fopen, __new_fopen)
 versioned_symbol (libc, _IO_new_fopen, _IO_fopen, GLIBC_2_1);
 versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1);
@@ -106,4 +97,3 @@ versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1);
 weak_alias (_IO_new_fopen, _IO_fopen64)
 weak_alias (_IO_new_fopen, fopen64)
 # endif
-#endif
index 1ec237599073f515b20093ac3ab2769f47a7935d..9230fc173ff9c112ae227471616bde8d67f568cd 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 
 /* iofopen.c defines _IO_fopen64/fopen64 as aliases if O_LARGEFILE==0.  */
-#if !defined _LIBC || (defined O_LARGEFILE && O_LARGEFILE != 0)
+#if defined O_LARGEFILE && O_LARGEFILE != 0
 
 _IO_FILE *
 _IO_fopen64 (const char *filename, const char *mode)
@@ -37,8 +37,6 @@ _IO_fopen64 (const char *filename, const char *mode)
   return __fopen_internal (filename, mode, 0);
 }
 
-#ifdef weak_alias
 weak_alias (_IO_fopen64, fopen64)
-#endif
 
 #endif
index 379f9b06958a587769a8973f2eeffe67b17783e2..c40efc06442e76f534650290fb9ab60baed1680f 100644 (file)
@@ -42,7 +42,6 @@ _IO_fputs (const char *str, _IO_FILE *fp)
 }
 libc_hidden_def (_IO_fputs)
 
-#ifdef weak_alias
 weak_alias (_IO_fputs, fputs)
 
 # ifndef _IO_MTSAFE_IO
@@ -51,4 +50,3 @@ libc_hidden_def (__fputs_unlocked)
 weak_alias (_IO_fputs, fputs_unlocked)
 libc_hidden_ver (_IO_fputs, fputs_unlocked)
 # endif
-#endif
index c6922d3dbf2fd58ee6b3b3a6152471943bb34d2a..8bb948ef4a2de161bcbae9856cb7e1b62c1f34e5 100644 (file)
@@ -41,7 +41,6 @@ _IO_fread (void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp)
 }
 libc_hidden_def (_IO_fread)
 
-#ifdef weak_alias
 weak_alias (_IO_fread, fread)
 
 # ifndef _IO_MTSAFE_IO
@@ -49,4 +48,3 @@ strong_alias (_IO_fread, __fread_unlocked)
 libc_hidden_def (__fread_unlocked)
 weak_alias (_IO_fread, fread_unlocked)
 # endif
-#endif
index 3809b6a0b0f33eb7fa17f63f0dc13798a0f5b655..1a71867e59b3eeff561a6d6c34b9e055ef424522 100644 (file)
@@ -49,10 +49,8 @@ _IO_new_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp)
     {
       /* ANSI explicitly requires setting errno to a positive value on
         failure.  */
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       result = EOF;
     }
   else
index 04b4ddf29f1bdc096010d710608ec757a47446cb..d3166ea20bd876df28246fec233ad40e7d93790b 100644 (file)
@@ -41,10 +41,8 @@ _IO_new_fsetpos64 (_IO_FILE *fp, const _IO_fpos64_t *posp)
     {
       /* ANSI explicitly requires setting errno to a positive value on
         failure.  */
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       result = EOF;
     }
   else
index 21ba5fc6e3dcb216f7d39fb923a408f20e52e41f..09d2a1147d0b24687de99a48449062e2596c9213 100644 (file)
@@ -44,23 +44,17 @@ _IO_ftell (_IO_FILE *fp)
   _IO_release_lock (fp);
   if (pos == _IO_pos_BAD)
     {
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       return -1L;
     }
   if ((_IO_off64_t) (long int) pos != pos)
     {
-#ifdef EOVERFLOW
       __set_errno (EOVERFLOW);
-#endif
       return -1L;
     }
   return pos;
 }
 libc_hidden_def (_IO_ftell)
 
-#ifdef weak_alias
 weak_alias (_IO_ftell, ftell)
-#endif
index 76efb32f5d3f20070678cfaac22d48fcfab07867..9b718c0ccdcc2cfb90c32d777fd84341df67f6dd 100644 (file)
    in files containing the exception.  */
 
 #include <libioP.h>
-#ifdef _LIBC
-# include <dlfcn.h>
-# include <wchar.h>
-#endif
+#include <dlfcn.h>
+#include <wchar.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef _LIBC
-# include <langinfo.h>
-# include <locale/localeinfo.h>
-# include <wcsmbs/wcsmbsload.h>
-# include <iconv/gconv_int.h>
-# include <shlib-compat.h>
-# include <sysdep.h>
-#endif
+#include <langinfo.h>
+#include <locale/localeinfo.h>
+#include <wcsmbs/wcsmbsload.h>
+#include <iconv/gconv_int.h>
+#include <shlib-compat.h>
+#include <sysdep.h>
 
 
 /* Prototypes of libio's codecvt functions.  */
@@ -90,8 +86,7 @@ _IO_fwide (_IO_FILE *fp, int mode)
   /* Normalize the value.  */
   mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
 
-#if defined SHARED && defined _LIBC \
-    && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
   if (__builtin_expect (&_IO_stdin_used == NULL, 0)
       && (fp == _IO_stdin || fp == _IO_stdout || fp == _IO_stderr))
     /* This is for a stream in the glibc 2.0 format.  */
@@ -114,7 +109,6 @@ _IO_fwide (_IO_FILE *fp, int mode)
 
       /* Get the character conversion functions based on the currently
         selected locale for LC_CTYPE.  */
-#ifdef _LIBC
       {
        /* Clear the state.  We start all over again.  */
        memset (&fp->_wide_data->_IO_state, '\0', sizeof (__mbstate_t));
@@ -145,41 +139,6 @@ _IO_fwide (_IO_FILE *fp, int mode)
          = __GCONV_IS_LAST | __GCONV_TRANSLIT;
        cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
       }
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
-      {
-       /* Determine internal and external character sets.
-
-          XXX For now we make our life easy: we assume a fixed internal
-          encoding (as most sane systems have; hi HP/UX!).  If somebody
-          cares about systems which changing internal charsets they
-          should come up with a solution for the determination of the
-          currently used internal character set.  */
-       const char *internal_ccs = _G_INTERNAL_CCS;
-       const char *external_ccs = NULL;
-
-#  ifdef HAVE_NL_LANGINFO
-       external_ccs = nl_langinfo (CODESET);
-#  endif
-       if (external_ccs == NULL)
-         external_ccs = "ISO-8859-1";
-
-       cc->__cd_in = iconv_open (internal_ccs, external_ccs);
-       if (cc->__cd_in != (iconv_t) -1)
-         cc->__cd_out = iconv_open (external_ccs, internal_ccs);
-
-       if (cc->__cd_in == (iconv_t) -1 || cc->__cd_out == (iconv_t) -1)
-         {
-           if (cc->__cd_in != (iconv_t) -1)
-             iconv_close (cc->__cd_in);
-           /* XXX */
-           abort ();
-         }
-      }
-# else
-#  error "somehow determine this from LC_CTYPE"
-# endif
-#endif
 
       /* From now on use the wide character callback functions.  */
       _IO_JUMPS_FILE_plus (fp) = fp->_wide_data->_wide_vtable;
@@ -200,7 +159,6 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 {
   enum __codecvt_result result;
 
-#ifdef _LIBC
   struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
   int status;
   size_t dummy;
@@ -240,28 +198,6 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
       result = __codecvt_error;
       break;
     }
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
-  size_t res;
-  const char *from_start_copy = (const char *) from_start;
-  size_t from_len = from_end - from_start;
-  char *to_start_copy = to_start;
-  size_t to_len = to_end - to_start;
-  res = iconv (codecvt->__cd_out, &from_start_copy, &from_len,
-              &to_start_copy, &to_len);
-
-  if (res == 0 || from_len == 0)
-    result = __codecvt_ok;
-  else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
-    result = __codecvt_partial;
-  else
-    result = __codecvt_error;
-
-# else
-  /* Decide what to do.  */
-  result = __codecvt_error;
-# endif
-#endif
 
   return result;
 }
@@ -273,7 +209,6 @@ do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 {
   enum __codecvt_result result;
 
-#ifdef _LIBC
   struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
   int status;
   size_t dummy;
@@ -310,25 +245,6 @@ do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep,
       result = __codecvt_error;
       break;
     }
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
-  size_t res;
-  char *to_start_copy = (char *) to_start;
-  size_t to_len = to_end - to_start;
-
-  res = iconv (codecvt->__cd_out, NULL, NULL, &to_start_copy, &to_len);
-
-  if (res == 0)
-    result = __codecvt_ok;
-  else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
-    result = __codecvt_partial;
-  else
-    result = __codecvt_error;
-# else
-  /* Decide what to do.  */
-  result = __codecvt_error;
-# endif
-#endif
 
   return result;
 }
@@ -341,7 +257,6 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 {
   enum __codecvt_result result;
 
-#ifdef _LIBC
   struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
   int status;
   size_t dummy;
@@ -381,30 +296,6 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
       result = __codecvt_error;
       break;
     }
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
-  size_t res;
-  const char *from_start_copy = (const char *) from_start;
-  size_t from_len = from_end - from_start;
-  char *to_start_copy = (char *) from_start;
-  size_t to_len = to_end - to_start;
-
-  res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
-              &to_start_copy, &to_len);
-
-  if (res == 0)
-    result = __codecvt_ok;
-  else if (to_len == 0)
-    result = __codecvt_partial;
-  else if (from_len < codecvt->__codecvt_do_max_length (codecvt))
-    result = __codecvt_partial;
-  else
-    result = __codecvt_error;
-# else
-  /* Decide what to do.  */
-  result = __codecvt_error;
-# endif
-#endif
 
   return result;
 }
@@ -413,7 +304,6 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 static int
 do_encoding (struct _IO_codecvt *codecvt)
 {
-#ifdef _LIBC
   /* See whether the encoding is stateful.  */
   if (codecvt->__cd_in.__cd.__steps[0].__stateful)
     return -1;
@@ -425,10 +315,6 @@ do_encoding (struct _IO_codecvt *codecvt)
     return 0;
 
   return codecvt->__cd_in.__cd.__steps[0].__min_needed_from;
-#else
-  /* Worst case scenario.  */
-  return -1;
-#endif
 }
 
 
@@ -444,7 +330,6 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
           const char *from_start, const char *from_end, _IO_size_t max)
 {
   int result;
-#ifdef _LIBC
   const unsigned char *cp = (const unsigned char *) from_start;
   wchar_t to_buf[max];
   struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
@@ -466,23 +351,6 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
                &dummy, 0, 0));
 
   result = cp - (const unsigned char *) from_start;
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
-  const char *from_start_copy = (const char *) from_start;
-  size_t from_len = from_end - from_start;
-  wchar_t to_buf[max];
-  size_t res;
-  char *to_start = (char *) to_buf;
-
-  res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
-              &to_start, &max);
-
-  result = from_start_copy - (char *) from_start;
-# else
-  /* Decide what to do.  */
-  result = 0;
-# endif
-#endif
 
   return result;
 }
@@ -491,9 +359,5 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 static int
 do_max_length (struct _IO_codecvt *codecvt)
 {
-#ifdef _LIBC
   return codecvt->__cd_in.__cd.__steps[0].__max_needed_from;
-#else
-  return MB_CUR_MAX;
-#endif
 }
index c89dd9091f356562b84b35bd4e836e3f09b0c2bc..72f703af62befe8cd746a8be0ee47974dad0772c 100644 (file)
@@ -49,7 +49,6 @@ _IO_fwrite (const void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp)
 }
 libc_hidden_def (_IO_fwrite)
 
-#ifdef weak_alias
 # include <stdio.h>
 weak_alias (_IO_fwrite, fwrite)
 libc_hidden_weak (fwrite)
@@ -57,4 +56,3 @@ libc_hidden_weak (fwrite)
 weak_alias (_IO_fwrite, fwrite_unlocked)
 libc_hidden_weak (fwrite_unlocked)
 # endif
-#endif
index 59138881b8e21f5b79aa46c62daeda0f47864e9a..0fce4af7684f7de763db99e803aca8e138d35186 100644 (file)
@@ -123,7 +123,5 @@ unlock_return:
   return result;
 }
 
-#ifdef weak_alias
 weak_alias (_IO_getdelim, __getdelim)
 weak_alias (_IO_getdelim, getdelim)
-#endif
index 432cecb75cf4ffa16bd388ac5afc2312331ab65b..166a88a4a9686d9b10d672b5b2fd37432029fc4f 100644 (file)
@@ -67,10 +67,6 @@ unlock_return:
   return retval;
 }
 
-#ifdef weak_alias
 weak_alias (_IO_gets, gets)
-#endif
 
-#ifdef _LIBC
 link_warning (gets, "the `gets' function is dangerous and should not be used.")
-#endif
index e60a590cc49e9f08da53a0c54c7c8e8343b93e53..535f90339e3381b8038a7b5ec137778bff22a2ac 100644 (file)
 #include <string.h>
 #include <wchar.h>
 
-#ifdef _LIBC
-# define wmemcpy __wmemcpy
-#endif
-
 _IO_size_t
 _IO_getwline (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim,
              int extract_delim)
@@ -98,12 +94,12 @@ _IO_getwline_info (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim,
                  if (extract_delim > 0)
                    ++len;
                }
-             wmemcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr,
-                      len);
+             __wmemcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr,
+                        len);
              fp->_wide_data->_IO_read_ptr = t;
              return old_len + len;
            }
-         wmemcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr, len);
+         __wmemcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr, len);
          fp->_wide_data->_IO_read_ptr += len;
          ptr += len;
          n -= len;
index a2ddebb32b86449eede9bf6f0b615f94d8282d7a..466260ea55d8cbc1604aacc1c61e4a4d296502e4 100644 (file)
    This exception applies to code released by its copyright holders
    in files containing the exception.  */
 
-#ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
 #include "libioP.h"
 #include <fcntl.h>
 #include <signal.h>
 #include <unistd.h>
 #include <stdlib.h>
-#ifdef _LIBC
-# include <shlib-compat.h>
-# include <not-cancel.h>
-#endif
+#include <shlib-compat.h>
+#include <not-cancel.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <kernel-features.h>
 
-#ifndef _IO_fork
-#ifdef _LIBC
-#define _IO_fork __fork
-#else
-#define _IO_fork fork /* defined in libiberty, if needed */
-#endif
-extern _IO_pid_t _IO_fork (void) __THROW;
-#endif
-
-#ifndef _IO_dup2
-#ifdef _LIBC
-#define _IO_dup2 __dup2
-#else
-#define _IO_dup2 dup2
-#endif
-extern int _IO_dup2 (int fd, int fd2) __THROW;
-#endif
-
-#ifndef _IO_waitpid
-#ifdef _LIBC
-#define _IO_waitpid __waitpid_nocancel
-#else
-#define _IO_waitpid waitpid
-#endif
-#endif
-
-#ifndef _IO_execl
-#define _IO_execl execl
-#endif
-#ifndef _IO__exit
-#define _IO__exit _exit
-#endif
-
-#ifndef _IO_close
-#ifdef _LIBC
-#define _IO_close __close_nocancel
-#else
-#define _IO_close close
-#endif
-#endif
-
 struct _IO_proc_file
 {
   struct _IO_FILE_plus file;
@@ -165,14 +119,14 @@ _IO_new_proc_open (_IO_FILE *fp, const char *command, const char *mode)
       read_or_write = _IO_NO_READS;
     }
 
-  ((_IO_proc_file *) fp)->pid = child_pid = _IO_fork ();
+  ((_IO_proc_file *) fp)->pid = child_pid = __fork ();
   if (child_pid == 0)
     {
       int child_std_end = do_read ? 1 : 0;
       struct _IO_proc_file *p;
 
       if (child_end != child_std_end)
-       _IO_dup2 (child_end, child_std_end);
+       __dup2 (child_end, child_std_end);
       else
        /* The descriptor is already the one we will use.  But it must
           not be marked close-on-exec.  Undo the effects.  */
@@ -188,16 +142,16 @@ _IO_new_proc_open (_IO_FILE *fp, const char *command, const char *mode)
             child_std_end, it has been already closed by the dup2 syscall
             above.  */
          if (fd != child_std_end)
-           _IO_close (fd);
+           __close_nocancel (fd);
        }
 
-      _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
-      _IO__exit (127);
+      execl ("/bin/sh", "sh", "-c", command, (char *) 0);
+      _exit (127);
     }
-  _IO_close (child_end);
+  __close_nocancel (child_end);
   if (child_pid < 0)
     {
-      _IO_close (parent_end);
+      __close_nocancel (parent_end);
       return NULL;
     }
 
@@ -284,7 +238,7 @@ _IO_new_proc_close (_IO_FILE *fp)
   _IO_cleanup_region_end (0);
 #endif
 
-  if (status < 0 || _IO_close (_IO_fileno(fp)) < 0)
+  if (status < 0 || __close_nocancel (_IO_fileno(fp)) < 0)
     return -1;
   /* POSIX.2 Rationale:  "Some historical implementations either block
      or ignore the signals SIGINT, SIGQUIT, and SIGHUP while waiting
@@ -292,7 +246,7 @@ _IO_new_proc_close (_IO_FILE *fp)
      described in POSIX.2, such implementations are not conforming." */
   do
     {
-      wait_pid = _IO_waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0);
+      wait_pid = __waitpid_nocancel (((_IO_proc_file *) fp)->pid, &wstatus, 0);
     }
   while (wait_pid == -1 && errno == EINTR);
   if (wait_pid == -1)
index bf3224e9abedca2fd785ebf6ad4a1e1c594760da..2529c7bbd1003be5ac7a0aecfc1b61cacae52474 100644 (file)
@@ -45,6 +45,4 @@ _IO_puts (const char *str)
   return result;
 }
 
-#ifdef weak_alias
 weak_alias (_IO_puts, puts)
-#endif
index 425c020c519cdbcfa75c45b83c25c688b5a0350f..e06b066a6f98093c0c2c9ffa4a02adaed3ea65dd 100644 (file)
 #include <stdlib.h>
 #include <libioP.h>
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
 
 _IO_off64_t
 _IO_seekoff_unlocked (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
index c5df900fd91a07357ae89b1b9157ac05e4f3958b..25a6032979d2ee2af968e14cfcbf45812183bacf 100644 (file)
@@ -42,6 +42,4 @@ _IO_setbuffer (_IO_FILE *fp, char *buf, _IO_size_t size)
 }
 libc_hidden_def (_IO_setbuffer)
 
-#ifdef weak_alias
 weak_alias (_IO_setbuffer, setbuffer)
-#endif
index b242018c0bfea599e4df392ef973699e1c0f50fe..eda49ab3aa63ad5056672f9660d420604d968440 100644 (file)
@@ -95,6 +95,4 @@ unlock_return:
 }
 libc_hidden_def (_IO_setvbuf)
 
-#ifdef weak_alias
 weak_alias (_IO_setvbuf, setvbuf)
-#endif
index 917cad8abb27e8ab5da687dff7f06564c382924a..cb59e0eb9816f7e537d6c41c91de6cd3841d4b7f 100644 (file)
@@ -41,6 +41,4 @@ _IO_ungetc (int c, _IO_FILE *fp)
   return result;
 }
 
-#ifdef weak_alias
 weak_alias (_IO_ungetc, ungetc)
-#endif
index 1832b44cc7f009aa9e72af6e3a6365e49d747a38..0613439ad4e8f03b36d09f3fe11cb202ec6fb81f 100644 (file)
 #include <stddef.h>
 
 #include <errno.h>
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-#if defined __GLIBC__ && __GLIBC__ >= 2
-# include <libc-lock.h>
-#else
-/*# include <comthread.h>*/
-#endif
+#include <libc-lock.h>
 
 #include <math_ldbl_opt.h>
 
 #include "iolibio.h"
 
-/* Control of exported symbols.  Used in glibc.  By default we don't
-   do anything.  */
-#ifndef libc_hidden_proto
-# define libc_hidden_proto(name)
-#endif
-#ifndef libc_hidden_def
-# define libc_hidden_def(name)
-#endif
-#ifndef libc_hidden_weak
-# define libc_hidden_weak(name)
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -89,14 +70,12 @@ extern "C" {
  * object being acted on (i.e. the 'this' parameter).
  */
 
-#ifdef _LIBC
-# include <shlib-compat.h>
-# if !SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
-   /* Setting this macro disables the use of the _vtable_offset
-      bias in _IO_JUMPS_FUNCS, below.  That is only needed if we
-      want to support old binaries (see oldfileops.c).  */
-#  define _G_IO_NO_BACKWARD_COMPAT 1
-# endif
+#include <shlib-compat.h>
+#if !SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+  /* Setting this macro disables the use of the _vtable_offset bias in
+     _IO_JUMPS_FUNCS, below.  That is only needed if we want to
+     support old binaries (see oldfileops.c).  */
+# define _G_IO_NO_BACKWARD_COMPAT 1
 #endif
 
 #if (!defined _IO_USE_OLD_IO_FILE \
@@ -524,19 +503,13 @@ extern int _IO_old_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *);
 extern void _IO_old_init (_IO_FILE *fp, int flags) __THROW;
 
 
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define _IO_do_flush(_f) \
+#define _IO_do_flush(_f) \
   ((_f)->_mode <= 0                                                          \
    ? _IO_do_write(_f, (_f)->_IO_write_base,                                  \
                  (_f)->_IO_write_ptr-(_f)->_IO_write_base)                   \
    : _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base,                     \
                   ((_f)->_wide_data->_IO_write_ptr                           \
                    - (_f)->_wide_data->_IO_write_base)))
-#else
-# define _IO_do_flush(_f) \
-  _IO_do_write(_f, (_f)->_IO_write_base,                                     \
-              (_f)->_IO_write_ptr-(_f)->_IO_write_base)
-#endif
 #define _IO_old_do_flush(_f) \
   _IO_old_do_write(_f, (_f)->_IO_write_base, \
                   (_f)->_IO_write_ptr-(_f)->_IO_write_base)
@@ -719,18 +692,6 @@ extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE *, _IO_off64_t, int)
 #ifndef EOF
 # define EOF (-1)
 #endif
-#ifndef NULL
-# if defined __GNUG__ && \
-    (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
-#  define NULL (__null)
-# else
-#  if !defined(__cplusplus)
-#   define NULL ((void*)0)
-#  else
-#   define NULL (0)
-#  endif
-# endif
-#endif
 
 #if _G_HAVE_MMAP
 
@@ -750,19 +711,6 @@ extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE *, _IO_off64_t, int)
 
 #endif /* _G_HAVE_MMAP */
 
-#if _G_HAVE_MMAP
-
-# ifdef _LIBC
-/* When using this code in the GNU libc we must not pollute the name space.  */
-#  define mmap __mmap
-#  define munmap __munmap
-#  define ftruncate __ftruncate
-# endif
-#endif /* _G_HAVE_MMAP */
-
-#ifndef OS_FSTAT
-# define OS_FSTAT fstat
-#endif
 extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
 
 /* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */
@@ -790,19 +738,11 @@ extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
 # else
-#  if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-#   define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
+#  define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
         NULL, WDP, 0 }
-#  else
-#   define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
-       { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
-        0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
-        0 }
-#  endif
 # endif
 #else
 # ifdef _IO_USE_OLD_IO_FILE
@@ -811,19 +751,11 @@ extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD }
 # else
-#  if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-#   define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
+#  define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
         NULL, WDP, 0 }
-#  else
-#   define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
-       { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
-        0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
-        0 }
-#  endif
 # endif
 #endif
 
index 2eceefa68abf7c34c068c54723dd63ff897a25d9..671b9822f094844788e4d7f3109f6e97f4be4713 100644 (file)
@@ -30,9 +30,6 @@
 #include <shlib-compat.h>
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 
-#ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
 #define _IO_USE_OLD_IO_FILE
 #include "libioP.h"
 #include <fcntl.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <unistd.h>
-#ifndef errno
-extern int errno;
-#endif
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-
-
-#ifdef _LIBC
-# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
-# define close(FD) __close (FD)
-# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
-# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
-# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
-#endif
 
 /* An fstream can be in at most one of put mode, get mode, or putback mode.
    Putback mode is a variant of get mode.
@@ -127,7 +109,6 @@ _IO_old_file_init_internal (struct _IO_FILE_plus *fp)
                             - (int) sizeof (struct _IO_FILE_complete));
   fp->file._fileno = -1;
 
-#if defined SHARED && defined _LIBC
   if (__builtin_expect (&_IO_stdin_used != NULL, 1)
       || (fp != (struct _IO_FILE_plus *) _IO_stdin
          && fp != (struct _IO_FILE_plus *) _IO_stdout
@@ -135,7 +116,6 @@ _IO_old_file_init_internal (struct _IO_FILE_plus *fp)
     /* The object is dynamically allocated and large enough.  Initialize
        the _mode element as well.  */
     ((struct _IO_FILE_complete *) fp)->_mode = -1;
-#endif
 }
 
 void
@@ -221,7 +201,7 @@ _IO_old_file_fopen (_IO_FILE *fp, const char *filename, const char *mode)
       omode = O_RDWR;
       read_write &= _IO_IS_APPENDING;
     }
-  fdesc = open (filename, omode|oflags, oprot);
+  fdesc = __open (filename, omode|oflags, oprot);
   if (fdesc < 0)
     return NULL;
   fp->_fileno = fdesc;
@@ -443,10 +423,8 @@ _IO_old_file_sync (_IO_FILE *fp)
       _IO_off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
       if (new_pos != (_IO_off_t) EOF)
        fp->_IO_read_end = fp->_IO_read_ptr;
-#ifdef ESPIPE
       else if (errno == ESPIPE)
        ; /* Ignore error from unseekable devices. */
-#endif
       else
        retval = EOF;
     }
@@ -647,7 +625,7 @@ _IO_old_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
   _IO_ssize_t to_do = n;
   while (to_do > 0)
     {
-      _IO_ssize_t count = write (f->_fileno, data, to_do);
+      _IO_ssize_t count = __write (f->_fileno, data, to_do);
       if (count == EOF)
        {
          f->_flags |= _IO_ERR_SEEN;
@@ -705,12 +683,7 @@ _IO_old_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
        count = to_do;
       if (count > 20)
        {
-#ifdef _LIBC
          f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
-#else
-         memcpy (f->_IO_write_ptr, s, count);
-         f->_IO_write_ptr += count;
-#endif
          s += count;
        }
       else
index 7f6180767edf573880929bf3230fe91aa90d447c..42284263ba55a9fc5613311422d12a1b2184ebac 100644 (file)
 #include "libioP.h"
 #include <fcntl.h>
 
-#ifndef _IO_fcntl
-# define _IO_fcntl __fcntl
-#endif
-
 _IO_FILE *
 attribute_compat_text_section
 _IO_old_fdopen (int fd, const char *mode)
@@ -69,11 +65,7 @@ _IO_old_fdopen (int fd, const char *mode)
   }
   if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
     read_write &= _IO_IS_APPENDING;
-#ifdef F_GETFL
-  fd_flags = _IO_fcntl (fd, F_GETFL);
-#ifndef O_ACCMODE
-#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-#endif
+  fd_flags = __fcntl (fd, F_GETFL);
   if (fd_flags == -1
       || ((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES))
       || ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS)))
@@ -97,12 +89,9 @@ _IO_old_fdopen (int fd, const char *mode)
      */
   if ((posix_mode & O_APPEND) && !(fd_flags & O_APPEND))
     {
-#ifdef F_SETFL
-      if (_IO_fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1)
-#endif
+      if (__fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1)
        return NULL;
     }
-#endif
 
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
index 9781b46d73b4bb34b14dcbbf18b55fca98ee5081..4d5d4f8ceb5ce077e674ea9749a92bff0f57fe93 100644 (file)
@@ -45,20 +45,16 @@ _IO_old_fgetpos (_IO_FILE *fp, _IO_fpos_t *posp)
     {
       /* ANSI explicitly requires setting errno to a positive value on
         failure.  */
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       return EOF;
     }
   posp->__pos = pos;
   return 0;
 }
 
-#ifdef weak_alias
 compat_symbol (libc, _IO_old_fgetpos, _IO_fgetpos, GLIBC_2_0);
 strong_alias (_IO_old_fgetpos, __old_fgetpos)
 compat_symbol (libc, __old_fgetpos, fgetpos, GLIBC_2_0);
-#endif
 
 #endif
index 2221f9140b497d56c9cea0001c2ce2e457a70843..3ba8941e9075aa8d12b9e2826347c55a49d70f02 100644 (file)
@@ -45,20 +45,16 @@ _IO_old_fgetpos64 (_IO_FILE *fp, _IO_fpos64_t *posp)
     {
       /* ANSI explicitly requires setting errno to a positive value on
         failure.  */
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       return EOF;
     }
   posp->__pos = pos;
   return 0;
 }
 
-#ifdef weak_alias
 compat_symbol (libc, _IO_old_fgetpos64, _IO_fgetpos64, GLIBC_2_1);
 strong_alias (_IO_old_fgetpos64, __old_fgetpos64)
 compat_symbol (libc, __old_fgetpos64, fgetpos64, GLIBC_2_1);
-#endif
 
 #endif
index d7119372631fb81d04160d932768fbd2f4e3cc45..4f93bf357821441e99851b9d1391d1d5eaa26fbf 100644 (file)
@@ -41,10 +41,8 @@ _IO_old_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp)
     {
       /* ANSI explicitly requires setting errno to a positive value on
         failure.  */
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       result = EOF;
     }
   else
@@ -53,10 +51,8 @@ _IO_old_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp)
   return result;
 }
 
-#ifdef weak_alias
 compat_symbol (libc, _IO_old_fsetpos, _IO_fsetpos, GLIBC_2_0);
 strong_alias (_IO_old_fsetpos, __old_fsetpos)
 compat_symbol (libc, __old_fsetpos, fsetpos, GLIBC_2_0);
-#endif
 
 #endif
index 7fad4081a1bfd8c102f84a5d32880c922eff82be..391cf5cf2afe00f6ef3c0f2a77e2c2f9975973c9 100644 (file)
@@ -42,10 +42,8 @@ _IO_old_fsetpos64 (_IO_FILE *fp, const _IO_fpos64_t *posp)
     {
       /* ANSI explicitly requires setting errno to a positive value on
         failure.  */
-#ifdef EIO
       if (errno == 0)
        __set_errno (EIO);
-#endif
       result = EOF;
     }
   else
@@ -54,10 +52,8 @@ _IO_old_fsetpos64 (_IO_FILE *fp, const _IO_fpos64_t *posp)
   return result;
 }
 
-#ifdef weak_alias
 compat_symbol (libc, _IO_old_fsetpos64, _IO_fsetpos64, GLIBC_2_1);
 strong_alias (_IO_old_fsetpos64, __old_fsetpos64)
 compat_symbol (libc, __old_fsetpos64, fsetpos64, GLIBC_2_1);
-#endif
 
 #endif
index af7774ae90c26680348a53e49db55992e7d9659a..2cb67879c31128b2c1a47b3162518dce0325557d 100644 (file)
    in files containing the exception.  */
 
 #define _IO_USE_OLD_IO_FILE
-#ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
 #include "libioP.h"
 #include <signal.h>
 #include <unistd.h>
 #include <stdlib.h>
-#ifdef _LIBC
-# include <unistd.h>
-#endif
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 
-#ifndef _IO_fork
-#ifdef _LIBC
-#define _IO_fork __fork
-#else
-#define _IO_fork fork /* defined in libiberty, if needed */
-#endif
-extern _IO_pid_t _IO_fork (void) __THROW;
-#endif
-
 #include <shlib-compat.h>
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 
-#ifndef _IO_pipe
-#ifdef _LIBC
-#define _IO_pipe __pipe
-#else
-#define _IO_pipe pipe
-#endif
-extern int _IO_pipe (int des[2]) __THROW;
-#endif
-
-#ifndef _IO_dup2
-#ifdef _LIBC
-#define _IO_dup2 __dup2
-#else
-#define _IO_dup2 dup2
-#endif
-extern int _IO_dup2 (int fd, int fd2) __THROW;
-#endif
-
-#ifndef _IO_waitpid
-#ifdef _LIBC
-#define _IO_waitpid __waitpid
-#else
-#define _IO_waitpid waitpid
-#endif
-#endif
-
-#ifndef _IO_execl
-#define _IO_execl execl
-#endif
-#ifndef _IO__exit
-#define _IO__exit _exit
-#endif
-
-#ifndef _IO_close
-#ifdef _LIBC
-#define _IO_close __close
-#else
-#define _IO_close close
-#endif
-#endif
-
 struct _IO_proc_file
 {
   struct _IO_FILE_complete_plus file;
@@ -123,7 +68,7 @@ _IO_old_proc_open (_IO_FILE *fp, const char *command, const char *mode)
   _IO_pid_t child_pid;
   if (_IO_file_is_open (fp))
     return NULL;
-  if (_IO_pipe (pipe_fds) < 0)
+  if (__pipe (pipe_fds) < 0)
     return NULL;
   if (mode[0] == 'r' && mode[1] == '\0')
     {
@@ -139,36 +84,36 @@ _IO_old_proc_open (_IO_FILE *fp, const char *command, const char *mode)
     }
   else
     {
-      _IO_close (pipe_fds[0]);
-      _IO_close (pipe_fds[1]);
+      __close (pipe_fds[0]);
+      __close (pipe_fds[1]);
       __set_errno (EINVAL);
       return NULL;
     }
-  ((_IO_proc_file *) fp)->pid = child_pid = _IO_fork ();
+  ((_IO_proc_file *) fp)->pid = child_pid = __fork ();
   if (child_pid == 0)
     {
       int child_std_end = mode[0] == 'r' ? 1 : 0;
       struct _IO_proc_file *p;
 
-      _IO_close (parent_end);
+      __close (parent_end);
       if (child_end != child_std_end)
        {
-         _IO_dup2 (child_end, child_std_end);
-         _IO_close (child_end);
+         __dup2 (child_end, child_std_end);
+         __close (child_end);
        }
       /* POSIX.2:  "popen() shall ensure that any streams from previous
          popen() calls that remain open in the parent process are closed
         in the new child process." */
       for (p = old_proc_file_chain; p; p = p->next)
-       _IO_close (_IO_fileno ((_IO_FILE *) p));
+       __close (_IO_fileno ((_IO_FILE *) p));
 
-      _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
-      _IO__exit (127);
+      execl ("/bin/sh", "sh", "-c", command, (char *) 0);
+      _exit (127);
     }
-  _IO_close (child_end);
+  __close (child_end);
   if (child_pid < 0)
     {
-      _IO_close (parent_end);
+      __close (parent_end);
       return NULL;
     }
   _IO_fileno (fp) = parent_end;
@@ -251,7 +196,7 @@ _IO_old_proc_close (_IO_FILE *fp)
   _IO_cleanup_region_end (0);
 #endif
 
-  if (status < 0 || _IO_close (_IO_fileno(fp)) < 0)
+  if (status < 0 || __close (_IO_fileno(fp)) < 0)
     return -1;
   /* POSIX.2 Rationale:  "Some historical implementations either block
      or ignore the signals SIGINT, SIGQUIT, and SIGHUP while waiting
@@ -259,7 +204,7 @@ _IO_old_proc_close (_IO_FILE *fp)
      described in POSIX.2, such implementations are not conforming." */
   do
     {
-      wait_pid = _IO_waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0);
+      wait_pid = __waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0);
     }
   while (wait_pid == -1 && errno == EINTR);
   if (wait_pid == -1)
index 6e1fdeef3a22b800412f762bf55a4c363be8f99b..2f48cd15e58405915bd3f9e1ecc5a7f25a1a7322 100644 (file)
@@ -36,11 +36,9 @@ libc_hidden_def (_IO_putc)
 
 #undef putc
 
-#ifdef weak_alias
 weak_alias (_IO_putc, putc)
 
 #ifndef _IO_MTSAFE_IO
 #undef putc_unlocked
 weak_alias (_IO_putc, putc_unlocked)
 #endif
-#endif
index 218be40e60dcc4dcd8b9673c2886ec87623cbd39..24725f0671da3b77250f79c5466dc02f35899e93 100644 (file)
 #include "libioP.h"
 
 #ifdef _IO_MTSAFE_IO
-# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-#  define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
   static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
   static struct _IO_wide_data _IO_wide_data_##FD \
     = { ._wide_vtable = &_IO_wfile_jumps }; \
   struct _IO_FILE_plus NAME \
     = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
        &_IO_file_jumps};
-# else
-#  define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
-  static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
-  struct _IO_FILE_plus NAME \
-    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
-       &_IO_file_jumps};
-# endif
 #else
-# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-#  define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
   static struct _IO_wide_data _IO_wide_data_##FD \
     = { ._wide_vtable = &_IO_wfile_jumps }; \
   struct _IO_FILE_plus NAME \
     = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
        &_IO_file_jumps};
-# else
-#  define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
-  struct _IO_FILE_plus NAME \
-    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
-       &_IO_file_jumps};
-# endif
 #endif
 
 DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
index 3ff825241b07977b638490b96e59af776f8bb08f..33292f04296e17bc2b1b4ca7825b14e1b44ea4bf 100644 (file)
@@ -37,12 +37,10 @@ _IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
 #undef _IO_stdin
 #undef _IO_stdout
 #undef _IO_stderr
-#ifdef _LIBC
-# define AL(name) AL2 (name, _IO_##name)
-# define AL2(name, al) \
+#define AL(name) AL2 (name, _IO_##name)
+#define AL2(name, al) \
   extern __typeof (name) al __attribute__ ((alias (#name),                    \
                                             visibility ("hidden")))
 AL(stdin);
 AL(stdout);
 AL(stderr);
-#endif
index fb94f45040f57f36c3fc6c98b699ef6f7f2b4c01..8756b6fe1aa46f311ee8cc58c6edbf28a16049ce 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-
-#ifndef _LIBC
-# define _IO_new_do_write _IO_do_write
-# define _IO_new_file_attach _IO_file_attach
-# define _IO_new_file_close_it _IO_file_close_it
-# define _IO_new_file_finish _IO_file_finish
-# define _IO_new_file_fopen _IO_file_fopen
-# define _IO_new_file_init _IO_file_init
-# define _IO_new_file_setbuf _IO_file_setbuf
-# define _IO_new_file_sync _IO_file_sync
-# define _IO_new_file_overflow _IO_file_overflow
-# define _IO_new_file_seekoff _IO_file_seekoff
-# define _IO_new_file_underflow _IO_file_underflow
-# define _IO_new_file_write _IO_file_write
-# define _IO_new_file_xsputn _IO_file_xsputn
-#endif
-
-
 /* Convert TO_DO wide character from DATA to FP.
    Then mark FP as having empty buffers. */
 int
@@ -541,10 +523,8 @@ _IO_wfile_sync (_IO_FILE *fp)
          fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_read_ptr;
          fp->_IO_read_end = fp->_IO_read_ptr;
        }
-#ifdef ESPIPE
       else if (errno == ESPIPE)
        ; /* Ignore error from unseekable devices. */
-#endif
       else
        retval = WEOF;
     }
@@ -1010,13 +990,8 @@ _IO_wfile_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
        count = to_do;
       if (count > 20)
        {
-#ifdef _LIBC
          f->_wide_data->_IO_write_ptr =
            __wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
-#else
-         wmemcpy (f->_wide_data->_IO_write_ptr, s, count);
-         f->_wide_data->_IO_write_ptr += count;
-#endif
          s += count;
        }
       else
index d8072abea014077a0f177d998c55b28f237a2089..a309de47b465d2c0dd36e166540b299e06793de5 100644 (file)
 #include <wchar.h>
 
 
-#ifndef _LIBC
-# define __wmemcpy(dst, src, n) wmemcpy (dst, src, n)
-#endif
-
-
-static int save_for_wbackup (_IO_FILE *fp, wchar_t *end_p) __THROW
-#ifdef _LIBC
-     internal_function
-#endif
-     ;
+static int save_for_wbackup (_IO_FILE *fp, wchar_t *end_p) __THROW;
 
 /* Return minimum _pos markers
    Assumes the current get area is the main get area. */
@@ -307,13 +298,8 @@ _IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
            count = more;
          if (count > 20)
            {
-#ifdef _LIBC
              f->_wide_data->_IO_write_ptr =
                __wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
-#else
-             memcpy (f->_wide_data->_IO_write_ptr, s, count);
-             f->_wide_data->_IO_write_ptr += count;
-#endif
              s += count;
             }
          else if (count <= 0)
@@ -353,12 +339,7 @@ _IO_wdefault_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
            count = more;
          if (count > 20)
            {
-#ifdef _LIBC
              s = __wmempcpy (s, fp->_wide_data->_IO_read_ptr, count);
-#else
-             memcpy (s, fp->_wide_data->_IO_read_ptr, count);
-             s += count;
-#endif
              fp->_wide_data->_IO_read_ptr += count;
            }
          else if (count <= 0)
@@ -466,9 +447,6 @@ _IO_switch_to_wput_mode (_IO_FILE *fp)
 
 
 static int
-#ifdef _LIBC
-internal_function
-#endif
 save_for_wbackup (_IO_FILE *fp, wchar_t *end_p)
 {
   /* Append [_IO_read_base..end_p] to backup area. */
@@ -492,32 +470,17 @@ save_for_wbackup (_IO_FILE *fp, wchar_t *end_p)
        return EOF;             /* FIXME */
       if (least_mark < 0)
        {
-#ifdef _LIBC
          __wmempcpy (__wmempcpy (new_buffer + avail,
                                  fp->_wide_data->_IO_save_end + least_mark,
                                  -least_mark),
                      fp->_wide_data->_IO_read_base,
                      end_p - fp->_wide_data->_IO_read_base);
-#else
-         memcpy (new_buffer + avail,
-                 fp->_wide_data->_IO_save_end + least_mark,
-                 -least_mark * sizeof (wchar_t));
-         memcpy (new_buffer + avail - least_mark,
-                 fp->_wide_data->_IO_read_base,
-                 (end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
-#endif
        }
       else
        {
-#ifdef _LIBC
          __wmemcpy (new_buffer + avail,
                     fp->_wide_data->_IO_read_base + least_mark,
                     needed_size);
-#else
-         memcpy (new_buffer + avail,
-                 fp->_wide_data->_IO_read_base + least_mark,
-                 needed_size * sizeof (wchar_t));
-#endif
        }
       free (fp->_wide_data->_IO_save_base);
       fp->_wide_data->_IO_save_base = new_buffer;
@@ -528,32 +491,17 @@ save_for_wbackup (_IO_FILE *fp, wchar_t *end_p)
       avail = current_Bsize - needed_size;
       if (least_mark < 0)
        {
-#ifdef _LIBC
          __wmemmove (fp->_wide_data->_IO_save_base + avail,
                      fp->_wide_data->_IO_save_end + least_mark,
                      -least_mark);
          __wmemcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
                     fp->_wide_data->_IO_read_base,
                     end_p - fp->_wide_data->_IO_read_base);
-#else
-         memmove (fp->_wide_data->_IO_save_base + avail,
-                  fp->_wide_data->_IO_save_end + least_mark,
-                  -least_mark * sizeof (wchar_t));
-         memcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
-                 fp->_wide_data->_IO_read_base,
-                 (end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
-#endif
        }
       else if (needed_size > 0)
-#ifdef _LIBC
        __wmemcpy (fp->_wide_data->_IO_save_base + avail,
                   fp->_wide_data->_IO_read_base + least_mark,
                   needed_size);
-#else
-       memcpy (fp->_wide_data->_IO_save_base + avail,
-               fp->_wide_data->_IO_read_base + least_mark,
-               needed_size * sizeof (wchar_t));
-#endif
     }
   fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_base + avail;
   /* Adjust all the streammarkers. */