static char rcsid[] = "@(#)$Id: alias_alloc.c,v 1.5 2006/04/09 07:37:30 hurtta Exp $";

/******************************************************************************
 *  The Elm (ME+) Mail System  -  $Revision: 1.5 $   $State: Exp $
 *
 *  Author: Kari Hurtta <hurtta+elm@posti.FMI.FI> (was hurtta+elm@ozone.FMI.FI)
 ******************************************************************************
 *  Some code copied from src/alias.c. That file is following
 *  copyright:
 *
 *  The Elm Mail System 
 *
 * 			Copyright (c) 1988-1992 USENET Community Trust
 * 			Copyright (c) 1986,1987 Dave Taylor
 *****************************************************************************/

#include "def_aliases.h"

DEBUG_VAR(Debug,__FILE__,"alias");

void realloc_aliases(astorage,current_count)
     struct current_astorage *astorage;
     int current_count;
{

    /* Code moved from src/alias.c -- function get_one_alias */

    if (current_count >= astorage->max_aliases) {
	int new_max = astorage->max_aliases + KLICK;
	if (astorage->max_aliases == 0) {
	    astorage->aliases = (struct alias_rec **)
		safe_malloc(new_max * sizeof(struct alias_rec *));
	} else {
	    astorage->aliases = (struct alias_rec **) 
		safe_realloc((malloc_t)(astorage->aliases),
			     new_max * sizeof(struct alias_rec *));
	}
	while (astorage->max_aliases < new_max)
	    astorage->aliases[astorage->max_aliases++] = NULL;
    }


}


/* Free's record */
void alias_free(h)
     struct alias_rec **h; 

{
    /* LOOK function fetch_alias() on lib/aliasdb.c
     *
     * alias_record pointer points to memory area
     * where first there is alias_rec and after it
     * actual data -- so we need only free pointer
     * not invididula fields!!!
     */

    if (*h) {
	free(*h);
	*h = NULL;
    }
    
}

/*
 * Local Variables:
 *  mode:c
 *  c-basic-offset:4
 *  buffer-file-coding-system: iso-8859-1
 * End:
 */


syntax highlighted by Code2HTML, v. 0.9.1