Skip to content

Commit

Permalink
Hacks to get libevent to compile with new Android NDK
Browse files Browse the repository at this point in the history
  • Loading branch information
nlebeck committed Mar 12, 2016
1 parent aadef8e commit 500ee4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions external/libevent/arc4random.c
Expand Up @@ -482,7 +482,7 @@ arc4random_addrandom(const unsigned char *dat, int datlen)

#ifndef ARC4RANDOM_NORANDOM
ARC4RANDOM_EXPORT ARC4RANDOM_UINT32
arc4random(void)
local_arc4random(void)
{
ARC4RANDOM_UINT32 val;
ARC4_LOCK_();
Expand All @@ -495,7 +495,7 @@ arc4random(void)
#endif

ARC4RANDOM_EXPORT void
arc4random_buf(void *buf_, size_t n)
local_arc4random_buf(void *buf_, size_t n)
{
unsigned char *buf = buf_;
ARC4_LOCK_();
Expand All @@ -520,7 +520,7 @@ arc4random_buf(void *buf_, size_t n)
* after reduction modulo upper_bound.
*/
ARC4RANDOM_EXPORT unsigned int
arc4random_uniform(unsigned int upper_bound)
local_arc4random_uniform(unsigned int upper_bound)
{
ARC4RANDOM_UINT32 r, min;

Expand All @@ -546,7 +546,7 @@ arc4random_uniform(unsigned int upper_bound)
* to re-roll.
*/
for (;;) {
r = arc4random();
r = local_arc4random();
if (r >= min)
break;
}
Expand Down
5 changes: 3 additions & 2 deletions external/libevent/evutil_rand.c
Expand Up @@ -40,7 +40,8 @@
#include "util-internal.h"
#include "evthread-internal.h"

#ifdef EVENT__HAVE_ARC4RANDOM
//#ifdef EVENT__HAVE_ARC4RANDOM
#ifdef EVENT__HAVE_ARC4RANDOM_HACK_NEVER_DEFINED // force libevent to use local version of arc4random
#include <stdlib.h>
#include <string.h>
int
Expand Down Expand Up @@ -181,7 +182,7 @@ evutil_secure_rng_init(void)
static void
ev_arc4random_buf(void *buf, size_t n)
{
arc4random_buf(buf, n);
local_arc4random_buf(buf, n);
}

#endif /* } !EVENT__HAVE_ARC4RANDOM */
Expand Down

0 comments on commit 500ee4d

Please sign in to comment.