FreeBSD/usr.bin/catman/catman.c
/*
 * Inserts a string into a hashtable keyed by inode & device number.
 */
Inserts a string into a hashtable keyed by inode & device number.
Inserts a string into a hashtable keyed by inode & device number .
static void
insert_hashtable(struct hash_entry **table,
    ino_t inode_number,
    dev_t device_number,
    const char *data)
{
	struct hash_entry *new_entry;
	struct hash_entry **chain;
	new_entry = (struct hash_entry *) malloc(sizeof(struct hash_entry));
	if (new_entry == NULL)
		err(1, "can't insert into hashtable");
	chain = &table[inode_number & HASH_MASK];
	new_entry->inode_number = inode_number;
	new_entry->device_number = device_number;
	new_entry->data = data;
	new_entry->next = *chain;
	*chain = new_entry;
}
static void insert_hashtable ( struct hash_entry * * table , ino_t inode_number , dev_t device_number , const char * data ) { struct hash_entry * new_entry ; struct hash_entry * * chain ; new_entry = ( struct hash_entry * ) malloc ( sizeof ( struct hash_entry ) ) ; if ( new_entry == NULL ) err ( 1 , " " ) ; chain = & table [ inode_number & HASH_MASK ] ; new_entry -> inode_number = inode_number ; new_entry -> device_number = device_number ; new_entry -> data = data ; new_entry -> next = * chain ; * chain = new_entry ; }
Inserts a string into a hashtable keyed by inode & device number.
Inserts a string into a hashtable keyed by inode & device number .