Exemplo n.º 1
0
static void*
svc_init(void* handle, int fdmax)
{
	State_t*	state;

	NoP(handle);
	if (!(state = newof(0, State_t, 1, (fdmax - 1) * sizeof(File_t*))))
		error(3, "out of space [state]");
	if (!(state->files = hashalloc(NiL, HASH_set, HASH_ALLOCATE, HASH_namesize, sizeof(Fid_t), HASH_name, "files", 0)))
		error(3, "out of space [files]");
	cstimeout(CS_SVC_DORMANT * 1000L);
	return((void*)state);
}
Exemplo n.º 2
0
HASHPTR InsertHash (HASHPTR symbol_tbl[], int size, char symbol[], int key)
{
    register HASHPTR hp;
    register int h;

    //printf("in insert !\n");
    if (key ==0) key = keyvalue (symbol);
    //printf("key = %d\n",key);
    h = key % size;

    hp = hashalloc(); 
    //printf("Created!\n");
    
	hp->key = key;
	hp->next = symbol_tbl[h];//την πρωτη φορα θα δειξει σε NULL meta ayto den allazei
	hp->symbol = astrcpy (hp->symbol, symbol);
   
	symbol_tbl[h]=hp;

	return(hp);
	
}