hasht.c

来自「关系型数据库 Postgresql 6.5.2」· C语言 代码 · 共 50 行

C
50
字号
/*------------------------------------------------------------------------- * * hasht.c *	  hash table related functions that are not directly supported *	  by the hashing packages under utils/hash. * * Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION *	  $Header: /usr/local/cvsroot/pgsql/src/backend/lib/hasht.c,v 1.8 1999/02/13 23:15:35 momjian Exp $ * *------------------------------------------------------------------------- */#include <postgres.h>#include <utils/memutils.h>#include <utils/hsearch.h>#include <lib/hasht.h>/* ----------------------------------- *		HashTableWalk * *		call function on every element in hashtable *		one extra argument, arg may be supplied * ----------------------------------- */voidHashTableWalk(HTAB *hashtable, HashtFunc function, int arg){	long	   *hashent;	long	   *data;	int			keysize;	keysize = hashtable->hctl->keysize;	hash_seq((HTAB *) NULL);	while ((hashent = hash_seq(hashtable)) != (long *) TRUE)	{		if (hashent == NULL)			elog(FATAL, "error in HashTableWalk.");		/*		 * XXX the corresponding hash table insertion does NOT LONGALIGN		 * -- make sure the keysize is ok		 */		data = (long *) LONGALIGN((char *) hashent + keysize);		(*function) (data, arg);	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?