FreeBSD/contrib/ntp/libntp/authkeys.c
/*
 * auth_moremem - get some more free key structures
 */
get some more free key structures
get some more free key structures
void
auth_moremem(
	int	keycount
	)
{
	symkey *	sk;
	int		i;
#ifdef DEBUG
	void *		base;
	symkey_alloc *	allocrec;
# define MOREMEM_EXTRA_ALLOC	(sizeof(*allocrec))
#else
# define MOREMEM_EXTRA_ALLOC	(0)
#endif
	i = (keycount > 0)
		? keycount
		: MEMINC;
	sk = emalloc_zero(i * sizeof(*sk) + MOREMEM_EXTRA_ALLOC);
#ifdef DEBUG
	base = sk;
#endif
	authnumfreekeys += i;
	for (; i > 0; i--, sk++) {
		LINK_SLIST(authfreekeys, sk, llink.f);
	}
#ifdef DEBUG
	allocrec = (void *)sk;
	allocrec->mem = base;
	LINK_SLIST(authallocs, allocrec, link);
#endif
}
void auth_moremem ( int keycount ) { symkey * sk ; int i ; #ifdef DEBUG void * base ; symkey_alloc * allocrec ; # define MOREMEM_EXTRA_ALLOC 	(sizeof(*allocrec)) #else # define MOREMEM_EXTRA_ALLOC 	(0) #endif i = ( keycount > 0 ) ? keycount : MEMINC ; sk = emalloc_zero ( i * sizeof ( * sk ) + MOREMEM_EXTRA_ALLOC ) ; #ifdef DEBUG base = sk ; #endif authnumfreekeys += i ; for ( ; i > 0 ; i -- , sk ++ ) { LINK_SLIST ( authfreekeys , sk , llink . f ) ; } #ifdef DEBUG allocrec = ( void * ) sk ; allocrec -> mem = base ; LINK_SLIST ( authallocs , allocrec , link ) ; #endif }
auth_moremem - get some more free key structures
auth_moremem - get some more free key structures