]> gitweb.factorcode.org Git - factor.git/commitdiff
libc: Add default strerror that is not threadsafe. Move threadsafe unix load to the...
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 4 Jul 2014 10:31:11 +0000 (03:31 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 4 Jul 2014 10:31:11 +0000 (03:31 -0700)
basis/libc/libc.factor

index 6f77321f642a6f50379aa855f62c76af309ae550..9930128b5e669bb12d53830e452a29735e4ab3d0 100644 (file)
@@ -9,9 +9,6 @@ IN: libc
 
 HOOK: strerror os ( errno -- str )
 
-! For strerror on Unix all platforms
-<< os windows? [ "libc.unix" require ] unless >>
-
 ! For libc.linux, libc.windows, libc.macosx...
 << "libc." os unparse append require >>
 
@@ -43,6 +40,12 @@ FUNCTION-ALIAS: (free)
 FUNCTION-ALIAS: (realloc)
     void* realloc ( void* alien, size_t size ) ;
 
+FUNCTION-ALIAS: strerror_unsafe
+    char* strerror ( int errno ) ;
+
+! Add a default strerror even though it's not threadsafe
+M: object strerror strerror_unsafe ;
+
 FUNCTION: int strerror_r ( int errno, char* buf, size_t buflen ) ;
 
 ERROR: libc-error errno message ;
@@ -121,3 +124,6 @@ FUNCTION: int system ( c-string command ) ;
 
 DESTRUCTOR: free
 DESTRUCTOR: (free)
+
+! For strerror on Unix all platforms
+<< os windows? [ "libc.unix" require ] unless >>