pike.git
/
src
/
post_modules
/
Nettle
/
nettle.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/post_modules/Nettle/nettle.cmod:74:
DECLARE_STORAGE; /*! @decl void create(void|int sources) *! The number of entropy sources that will feed entropy to the *! random number generator is given as an argument to Yarrow *! during instantiation. *! @seealso *! @[update] */
-
PIKEFUN void create(void|int arg)
+
PIKEFUN void create(void|int
(1..)
arg)
flags ID_PROTECTED; { INT32 num = 0; if(arg) {
-
if (TYPEOF(*arg) != PIKE_T_INT)
-
Pike_error("Bad argument type.\n");
+
num = arg->u.integer; if(num < 0) Pike_error("Invalid number of sources.\n"); free (THIS->sources);
-
+
if( num > 0 )
THIS->sources = xalloc(sizeof(struct yarrow_source)*num);
-
+
else
+
THIS->sources = NULL;
pop_stack(); } else { free (THIS->sources); THIS->sources = NULL; } yarrow256_init(&THIS->ctx, num, THIS->sources); }