]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - libio/ioungetc.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / libio / ioungetc.c
index 7ebd3e59230c064721413e040f36188557db53cf..246f9d440f185816f1a34f0dc1926f7f4094c0d9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993-2012 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.
+   <https://www.gnu.org/licenses/>.
 
    As a special exception, if you link the code in this file with
    files compiled with a GNU compiler to produce an executable,
 #include "libioP.h"
 
 int
-_IO_ungetc (c, fp)
-     int c;
-     _IO_FILE *fp;
+_IO_ungetc (int c, FILE *fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
   if (c == EOF)
     return EOF;
-  _IO_acquire_lock (fp); 
+  if (!_IO_need_lock (fp))
+    return _IO_sputbackc (fp, (unsigned char) c);
+  _IO_acquire_lock (fp);
   result = _IO_sputbackc (fp, (unsigned char) c);
   _IO_release_lock (fp);
   return result;
 }
 
-#ifdef weak_alias
 weak_alias (_IO_ungetc, ungetc)
-#endif