PPP, magic, build-out useless code when LWIP_RAND is defined

This commit is contained in:
Sylvain Rochet 2015-09-01 10:29:53 +02:00
parent 0f3fbb267b
commit c4a1cad81b

View File

@ -195,7 +195,9 @@ u32_t magic(void) {
/*****************************/ /*****************************/
/*** LOCAL DATA STRUCTURES ***/ /*** LOCAL DATA STRUCTURES ***/
/*****************************/ /*****************************/
#ifndef LWIP_RAND
static int magic_randomized; /* Set when truely randomized. */ static int magic_randomized; /* Set when truely randomized. */
#endif /* LWIP_RAND */
static u32_t magic_randomseed; /* Seed used for random number generation. */ static u32_t magic_randomseed; /* Seed used for random number generation. */
@ -235,14 +237,18 @@ void magic_init(void) {
* bits. * bits.
*/ */
void magic_randomize(void) { void magic_randomize(void) {
#ifndef LWIP_RAND
if (!magic_randomized) { if (!magic_randomized) {
magic_randomized = !0; magic_randomized = !0;
magic_init(); magic_init();
/* The initialization function also updates the seed. */ /* The initialization function also updates the seed. */
} else { } else {
#endif /* LWIP_RAND */
/* magic_randomseed += (magic_randomseed << 16) + TM1; */ /* magic_randomseed += (magic_randomseed << 16) + TM1; */
magic_randomseed += sys_jiffies() & 0xffff; /* XXX */ magic_randomseed += sys_jiffies() & 0xffff; /* XXX */
#ifndef LWIP_RAND
} }
#endif /* LWIP_RAND */
} }
/* /*