* include/stdio_ext.h (__fsetlocking): Define as macro.
authorUlrich Drepper <drepper@redhat.com>
Mon, 1 Oct 2007 21:21:46 +0000 (21:21 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 1 Oct 2007 21:21:46 +0000 (21:21 +0000)
ChangeLog
include/stdio_ext.h

index d76ca47..3c6cb57 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-01  Ulrich Drepper  <drepper@redhat.com>
+
+       * include/stdio_ext.h (__fsetlocking): Define as macro.
+
 2007-09-30  Ulrich Drepper  <drepper@redhat.com>
 
        * locale/programs/ld-collate.c (collate_finish): Compare all bytes
index 31c7a4e..c7b7724 100644 (file)
@@ -4,8 +4,19 @@
 
 extern int __fsetlocking_internal (FILE *__fp, int __type) attribute_hidden;
 
-#ifndef NOT_IN_libc
-# define __fsetlocking(fp, type) INTUSE(__fsetlocking) (fp, type)
-#endif
+#define __fsetlocking(fp, type) \
+  ({ int __result = ((fp->_flags & _IO_USER_LOCK)                      \
+                    ? FSETLOCKING_BYCALLER : FSETLOCKING_INTERNAL);    \
+                                                                       \
+     if (type != FSETLOCKING_QUERY)                                    \
+       {                                                               \
+        fp->_flags &= ~_IO_USER_LOCK;                                  \
+        if (type == FSETLOCKING_BYCALLER)                              \
+          fp->_flags |= _IO_USER_LOCK;                                 \
+       }                                                               \
+                                                                       \
+     __result;                                                         \
+  })
+
 
 #endif