Skip to content

Commit e8e09b6

Browse files
committed
Remove rand_r implementation
We already use our own mt13397 implementation nowadays, so we no longer need this shim.
1 parent 97cb81e commit e8e09b6

File tree

3 files changed

+0
-64
lines changed

3 files changed

+0
-64
lines changed

configure.ac

-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ nl_langinfo \
582582
poll \
583583
ptsname \
584584
putenv \
585-
rand_r \
586585
scandir \
587586
setitimer \
588587
setenv \

main/php_reentrancy.h

-6
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ char *strtok_r(char *s, const char *delim, char **last);
9999
#endif
100100
#endif
101101

102-
#if !defined(HAVE_RAND_R)
103-
PHPAPI int php_rand_r(unsigned int *seed);
104-
#else
105-
#define php_rand_r rand_r
106-
#endif
107-
108102
END_EXTERN_C()
109103

110104
#if !defined(ZTS)

main/reentrancy.c

-57
Original file line numberDiff line numberDiff line change
@@ -207,63 +207,6 @@ void reentrancy_shutdown(void)
207207

208208
#endif
209209

210-
#ifndef HAVE_RAND_R
211-
212-
/*-
213-
* Copyright (c) 1990, 1993
214-
* The Regents of the University of California. All rights reserved.
215-
*
216-
* Redistribution and use in source and binary forms, with or without
217-
* modification, are permitted provided that the following conditions
218-
* are met:
219-
* 1. Redistributions of source code must retain the above copyright
220-
* notice, this list of conditions and the following disclaimer.
221-
* 2. Redistributions in binary form must reproduce the above copyright
222-
* notice, this list of conditions and the following disclaimer in the
223-
* documentation and/or other materials provided with the distribution.
224-
* 3. All advertising materials mentioning features or use of this software
225-
* must display the following acknowledgement:
226-
* This product includes software developed by the University of
227-
* California, Berkeley and its contributors.
228-
* 4. Neither the name of the University nor the names of its contributors
229-
* may be used to endorse or promote products derived from this software
230-
* without specific prior written permission.
231-
*
232-
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
233-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
234-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
235-
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
236-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
237-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
238-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
240-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
241-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
242-
* SUCH DAMAGE.
243-
*
244-
* Posix rand_r function added May 1999 by Wes Peters <[email protected]>.
245-
*/
246-
247-
#include <sys/types.h>
248-
#include <stdlib.h>
249-
250-
static int
251-
do_rand(unsigned long *ctx)
252-
{
253-
return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)PHP_RAND_MAX + 1));
254-
}
255-
256-
257-
PHPAPI int
258-
php_rand_r(unsigned int *ctx)
259-
{
260-
u_long val = (u_long) *ctx;
261-
*ctx = do_rand(&val);
262-
return (int) *ctx;
263-
}
264-
265-
#endif
266-
267210

268211
#ifndef HAVE_STRTOK_R
269212

0 commit comments

Comments
 (0)