Explorar el Código

hidden initstate_r and use

Peter S. Mazinger hace 20 años
padre
commit
56605ce864
Se han modificado 2 ficheros con 3 adiciones y 5 borrados
  1. 1 0
      libc/stdlib/random.c
  2. 2 5
      libc/stdlib/random_r.c

+ 1 - 0
libc/stdlib/random.c

@@ -25,6 +25,7 @@
 #define random_r __random_r
 #define random_r __random_r
 #define srandom_r __srandom_r
 #define srandom_r __srandom_r
 #define setstate_r __setstate_r
 #define setstate_r __setstate_r
+#define initstate_r __initstate_r
 
 
 #define _GNU_SOURCE
 #define _GNU_SOURCE
 #include <features.h>
 #include <features.h>

+ 2 - 5
libc/stdlib/random_r.c

@@ -258,11 +258,7 @@ strong_alias(__srandom_r,srandom_r)
    Note: The first thing we do is save the current state, if any, just like
    Note: The first thing we do is save the current state, if any, just like
    setstate so that it doesn't matter when initstate is called.
    setstate so that it doesn't matter when initstate is called.
    Returns a pointer to the old state.  */
    Returns a pointer to the old state.  */
-int initstate_r (seed, arg_state, n, buf)
-     unsigned int seed;
-     char *arg_state;
-     size_t n;
-     struct random_data *buf;
+int attribute_hidden __initstate_r (unsigned int seed, char *arg_state, size_t n, struct random_data *buf)
 {
 {
     int type;
     int type;
     int degree;
     int degree;
@@ -310,6 +306,7 @@ fail:
     __set_errno (EINVAL);
     __set_errno (EINVAL);
     return -1;
     return -1;
 }
 }
+strong_alias(__initstate_r,initstate_r)
 
 
 /* Restore the state from the given state array.
 /* Restore the state from the given state array.
    Note: It is important that we also remember the locations of the pointers
    Note: It is important that we also remember the locations of the pointers