Beispiel #1
0
void * init_hash_list(int order,int type,int subtype)
{
	int i;
	if(order<0)
		return NULL;
	if(order>10)
		return NULL;
	UUID_LIST * hash_head;
	hash_head=Salloc0(sizeof(UUID_LIST));
	if(hash_head==NULL)
		return NULL;
	hash_head->hash_num=1<<order;
	hash_head->desc=NULL;
	hash_head->curr_index=0;
	hash_head->hash_table=Salloc(sizeof(Record_List)*hash_head->hash_num);

	if(hash_head->hash_table==NULL)
		return NULL;
	for(i=0;i<hash_head->hash_num;i++)
	{
		INIT_LIST_HEAD(&(hash_head->hash_table[i].list));
		hash_head->hash_table[i].record=NULL;
	}
	return hash_head;
}
Beispiel #2
0
Datei: T.c Projekt: ntozubod/ginr
T_OBJECT T_create( )
{
	register T_OBJECT T;
	T = (T_OBJECT) Salloc( sizeof(struct T_desc) );
	T-> Type = T_Object;
	T-> T_n  = 0;
	T-> T_lname = 0;
	T-> T_lhash = 1;
	T-> T_name = 0;
	T-> T_hash = s_alloc( 1 );
	T-> T_hash[ 0 ] = MAXSHORT;
	return( T );
}
Beispiel #3
0
void * Palloc(int size,void * base)
{
	switch(	alloc_pointer_type(base))
	{
		case ALLOC_TEMP:
			return Talloc(size);
		case ALLOC_STATIC:
			return Salloc(size);
		case ALLOC_DYNAMIC:
			return Dalloc(size,base);
		case ALLOC_CACHE:
			return Calloc(size);
		default:
			return NULL;
	}	
}