chiark / gitweb /
[PATCH] update to klibc version 0.101, fixing the stdin bug.
[elogind.git] / klibc / klibc / include / stdio.h
index 31a1fe40af29647a85d10af76695f151f3f4d736..fba1e30746a9d33c0b153cf049b5e039209d608c 100644 (file)
 struct _IO_file;
 typedef struct _IO_file FILE;
 
-#define stdin  ((FILE *)0)
-#define stdout ((FILE *)1)
-#define stderr ((FILE *)2)
-
 #ifndef EOF
 # define EOF (-1)
 #endif
@@ -44,10 +40,12 @@ static __inline__ int fileno(FILE *__f)
   return (int)(size_t)__f - 1;
 }
 
-static __inline__ FILE * __create_file(int __fd)
-{
-  return (FILE *)(size_t)(__fd + 1);
-}
+/* This is a macro so it can be used as initializer */
+#define __create_file(__fd) ((FILE *)(size_t)((__fd) + 1))
+
+#define stdin  __create_file(0)
+#define stdout __create_file(1)
+#define stderr __create_file(2)
 
 __extern FILE *fopen(const char *, const char *);