mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
Bug 5961 - new RAND() function
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7920 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
utils.c
13
utils.c
@@ -881,6 +881,19 @@ int getloadavg(double *list, int nelem)
|
||||
#endif /* linux */
|
||||
#endif /* !defined(_BSD_SOURCE) */
|
||||
|
||||
/* glibc puts a lock inside random(3), so that the results are thread-safe.
|
||||
* BSD libc (and others) do not. */
|
||||
#ifndef linux
|
||||
long int ast_random(void)
|
||||
{
|
||||
long int res;
|
||||
ast_mutex_lock(&randomlock);
|
||||
res = random();
|
||||
ast_mutex_unlock(&randomlock);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
char *ast_process_quotes_and_slashes(char *start, char find, char replace_with)
|
||||
{
|
||||
char *dataPut = start;
|
||||
|
Reference in New Issue
Block a user