1616 *
1717 * Copyright (c) 2001, PostgreSQL Global Development Group
1818 *
19- * $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.7 2001/08/23 23:06:37 tgl Exp $
19+ * $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.8 2001/10/01 05:36:13 tgl Exp $
2020 * ----------
2121 */
2222#include "postgres.h"
@@ -511,7 +511,8 @@ pgstat_vacuum_tabstat(void)
511511 * Lookup our own database entry
512512 */
513513 dbentry = (PgStat_StatDBEntry * )hash_search (pgStatDBHash ,
514- (char * )& MyDatabaseId , HASH_FIND , & found );
514+ (void * ) & MyDatabaseId ,
515+ HASH_FIND , & found );
515516 if (!found || dbentry == NULL )
516517 return -1 ;
517518
@@ -926,8 +927,9 @@ pgstat_fetch_stat_dbentry(Oid dbid)
926927 /*
927928 * Lookup the requested database
928929 */
929- dbentry = (PgStat_StatDBEntry * )hash_search (pgStatDBHash ,
930- (char * )& dbid , HASH_FIND , & found );
930+ dbentry = (PgStat_StatDBEntry * ) hash_search (pgStatDBHash ,
931+ (void * ) & dbid ,
932+ HASH_FIND , & found );
931933 if (!found || dbentry == NULL )
932934 return NULL ;
933935
@@ -966,8 +968,9 @@ pgstat_fetch_stat_tabentry(Oid relid)
966968 /*
967969 * Lookup our database.
968970 */
969- dbentry = (PgStat_StatDBEntry * )hash_search (pgStatDBHash ,
970- (char * )& MyDatabaseId , HASH_FIND , & found );
971+ dbentry = (PgStat_StatDBEntry * ) hash_search (pgStatDBHash ,
972+ (void * ) & MyDatabaseId ,
973+ HASH_FIND , & found );
971974 if (!found || dbentry == NULL )
972975 return NULL ;
973976
@@ -976,8 +979,9 @@ pgstat_fetch_stat_tabentry(Oid relid)
976979 */
977980 if (dbentry -> tables == NULL )
978981 return NULL ;
979- tabentry = (PgStat_StatTabEntry * )hash_search (dbentry -> tables ,
980- (char * )& relid , HASH_FIND , & found );
982+ tabentry = (PgStat_StatTabEntry * ) hash_search (dbentry -> tables ,
983+ (void * ) & relid ,
984+ HASH_FIND , & found );
981985 if (!found || tabentry == NULL )
982986 return NULL ;
983987
@@ -1197,9 +1201,9 @@ pgstat_main(int real_argc, char *real_argv[])
11971201 * Create the dead backend hashtable
11981202 */
11991203 memset (& hash_ctl , 0 , sizeof (hash_ctl ));
1200- hash_ctl .keysize = sizeof (int );
1201- hash_ctl .datasize = sizeof (PgStat_StatBeDead );
1202- hash_ctl .hash = tag_hash ;
1204+ hash_ctl .keysize = sizeof (int );
1205+ hash_ctl .entrysize = sizeof (PgStat_StatBeDead );
1206+ hash_ctl .hash = tag_hash ;
12031207 pgStatBeDead = hash_create (PGSTAT_BE_HASH_SIZE , & hash_ctl ,
12041208 HASH_ELEM | HASH_FUNCTION );
12051209 if (pgStatBeDead == NULL )
@@ -1720,8 +1724,9 @@ pgstat_add_backend(PgStat_MsgHdr *msg)
17201724 *
17211725 * If the backend is known to be dead, we ignore this add.
17221726 */
1723- deadbe = (PgStat_StatBeDead * )hash_search (pgStatBeDead ,
1724- (char * )& (msg -> m_procpid ), HASH_FIND , & found );
1727+ deadbe = (PgStat_StatBeDead * ) hash_search (pgStatBeDead ,
1728+ (void * ) & (msg -> m_procpid ),
1729+ HASH_FIND , & found );
17251730 if (deadbe == NULL )
17261731 {
17271732 fprintf (stderr , "PGSTAT: Dead backend table corrupted - abort\n" );
@@ -1747,9 +1752,9 @@ pgstat_add_backend(PgStat_MsgHdr *msg)
17471752 /*
17481753 * Lookup or create the database entry for this backends DB.
17491754 */
1750- dbentry = (PgStat_StatDBEntry * )hash_search (pgStatDBHash ,
1751- ( char * )& (msg -> m_databaseid ), HASH_ENTER ,
1752- & found );
1755+ dbentry = (PgStat_StatDBEntry * ) hash_search (pgStatDBHash ,
1756+ ( void * ) & (msg -> m_databaseid ),
1757+ HASH_ENTER , & found );
17531758 if (dbentry == NULL )
17541759 {
17551760 fprintf (stderr , "PGSTAT: DB hash table corrupted - abort\n" );
@@ -1772,9 +1777,9 @@ pgstat_add_backend(PgStat_MsgHdr *msg)
17721777 dbentry -> destroy = 0 ;
17731778
17741779 memset (& hash_ctl , 0 , sizeof (hash_ctl ));
1775- hash_ctl .keysize = sizeof (Oid );
1776- hash_ctl .datasize = sizeof (PgStat_StatTabEntry );
1777- hash_ctl .hash = tag_hash ;
1780+ hash_ctl .keysize = sizeof (Oid );
1781+ hash_ctl .entrysize = sizeof (PgStat_StatTabEntry );
1782+ hash_ctl .hash = tag_hash ;
17781783 dbentry -> tables = hash_create (PGSTAT_TAB_HASH_SIZE , & hash_ctl ,
17791784 HASH_ELEM | HASH_FUNCTION );
17801785 if (dbentry -> tables == NULL )
@@ -1827,8 +1832,9 @@ pgstat_sub_backend(int procpid)
18271832 * the counting of backends, not the table access stats they
18281833 * sent).
18291834 */
1830- deadbe = (PgStat_StatBeDead * )hash_search (pgStatBeDead ,
1831- (char * )& procpid , HASH_ENTER , & found );
1835+ deadbe = (PgStat_StatBeDead * ) hash_search (pgStatBeDead ,
1836+ (void * ) & procpid ,
1837+ HASH_ENTER , & found );
18321838 if (deadbe == NULL )
18331839 {
18341840 fprintf (stderr , "PGSTAT: dead backend hash table corrupted "
@@ -1914,8 +1920,8 @@ pgstat_write_statsfile(void)
19141920 hash_destroy (dbentry -> tables );
19151921
19161922 hentry = hash_search (pgStatDBHash ,
1917- ( char * )& (dbentry -> databaseid ),
1918- HASH_REMOVE , & found );
1923+ ( void * ) & (dbentry -> databaseid ),
1924+ HASH_REMOVE , & found );
19191925 if (hentry == NULL )
19201926 {
19211927 fprintf (stderr , "PGSTAT: database hash table corrupted "
@@ -1959,7 +1965,7 @@ pgstat_write_statsfile(void)
19591965 if (-- (tabentry -> destroy ) == 0 )
19601966 {
19611967 hentry = hash_search (dbentry -> tables ,
1962- (char * )& (tabentry -> tableid ),
1968+ (void * ) & (tabentry -> tableid ),
19631969 HASH_REMOVE , & found );
19641970 if (hentry == NULL )
19651971 {
@@ -2047,7 +2053,8 @@ pgstat_write_statsfile(void)
20472053 */
20482054 if (-- (deadbe -> destroy ) <= 0 )
20492055 {
2050- hentry = hash_search (pgStatBeDead , (char * )& (deadbe -> procpid ),
2056+ hentry = hash_search (pgStatBeDead ,
2057+ (void * ) & (deadbe -> procpid ),
20512058 HASH_REMOVE , & found );
20522059 if (hentry == NULL )
20532060 {
@@ -2107,10 +2114,10 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
21072114 * Create the DB hashtable
21082115 */
21092116 memset (& hash_ctl , 0 , sizeof (hash_ctl ));
2110- hash_ctl .keysize = sizeof (Oid );
2111- hash_ctl .datasize = sizeof (PgStat_StatDBEntry );
2112- hash_ctl .hash = tag_hash ;
2113- hash_ctl .hcxt = use_mcxt ;
2117+ hash_ctl .keysize = sizeof (Oid );
2118+ hash_ctl .entrysize = sizeof (PgStat_StatDBEntry );
2119+ hash_ctl .hash = tag_hash ;
2120+ hash_ctl .hcxt = use_mcxt ;
21142121 * dbhash = hash_create (PGSTAT_DB_HASH_SIZE , & hash_ctl ,
21152122 HASH_ELEM | HASH_FUNCTION | mcxt_flags );
21162123 if (pgStatDBHash == NULL )
@@ -2175,8 +2182,8 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
21752182 /*
21762183 * Add to the DB hash
21772184 */
2178- dbentry = (PgStat_StatDBEntry * )hash_search (* dbhash ,
2179- (char * )& dbbuf .databaseid ,
2185+ dbentry = (PgStat_StatDBEntry * ) hash_search (* dbhash ,
2186+ (void * ) & dbbuf .databaseid ,
21802187 HASH_ENTER , & found );
21812188 if (dbentry == NULL )
21822189 {
@@ -2222,10 +2229,10 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
22222229
22232230
22242231 memset (& hash_ctl , 0 , sizeof (hash_ctl ));
2225- hash_ctl .keysize = sizeof (Oid );
2226- hash_ctl .datasize = sizeof (PgStat_StatTabEntry );
2227- hash_ctl .hash = tag_hash ;
2228- hash_ctl .hcxt = use_mcxt ;
2232+ hash_ctl .keysize = sizeof (Oid );
2233+ hash_ctl .entrysize = sizeof (PgStat_StatTabEntry );
2234+ hash_ctl .hash = tag_hash ;
2235+ hash_ctl .hcxt = use_mcxt ;
22292236 dbentry -> tables = hash_create (PGSTAT_TAB_HASH_SIZE , & hash_ctl ,
22302237 HASH_ELEM | HASH_FUNCTION | mcxt_flags );
22312238 if (dbentry -> tables == NULL )
@@ -2286,8 +2293,8 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
22862293 if (tabhash == NULL )
22872294 break ;
22882295
2289- tabentry = (PgStat_StatTabEntry * )hash_search (tabhash ,
2290- (char * )& tabbuf .tableid ,
2296+ tabentry = (PgStat_StatTabEntry * ) hash_search (tabhash ,
2297+ (void * ) & tabbuf .tableid ,
22912298 HASH_ENTER , & found );
22922299 if (tabentry == NULL )
22932300 {
@@ -2411,7 +2418,7 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
24112418 * Count backends per database here.
24122419 */
24132420 dbentry = (PgStat_StatDBEntry * )hash_search (* dbhash ,
2414- (char * )& ((* betab )[havebackends ].databaseid ),
2421+ (void * ) & ((* betab )[havebackends ].databaseid ),
24152422 HASH_FIND , & found );
24162423 if (found )
24172424 dbentry -> n_backends ++ ;
@@ -2525,8 +2532,8 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
25252532 /*
25262533 * Lookup the database in the hashtable.
25272534 */
2528- dbentry = (PgStat_StatDBEntry * )hash_search (pgStatDBHash ,
2529- (char * )& (msg -> m_hdr .m_databaseid ),
2535+ dbentry = (PgStat_StatDBEntry * ) hash_search (pgStatDBHash ,
2536+ (void * ) & (msg -> m_hdr .m_databaseid ),
25302537 HASH_FIND , & found );
25312538 if (dbentry == NULL )
25322539 {
@@ -2551,8 +2558,8 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
25512558 */
25522559 for (i = 0 ; i < msg -> m_nentries ; i ++ )
25532560 {
2554- tabentry = (PgStat_StatTabEntry * )hash_search (dbentry -> tables ,
2555- (char * )& (tabmsg [i ].t_id ),
2561+ tabentry = (PgStat_StatTabEntry * ) hash_search (dbentry -> tables ,
2562+ (void * ) & (tabmsg [i ].t_id ),
25562563 HASH_ENTER , & found );
25572564 if (tabentry == NULL )
25582565 {
@@ -2625,8 +2632,8 @@ pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len)
26252632 /*
26262633 * Lookup the database in the hashtable.
26272634 */
2628- dbentry = (PgStat_StatDBEntry * )hash_search (pgStatDBHash ,
2629- (char * )& (msg -> m_hdr .m_databaseid ),
2635+ dbentry = (PgStat_StatDBEntry * ) hash_search (pgStatDBHash ,
2636+ (void * ) & (msg -> m_hdr .m_databaseid ),
26302637 HASH_FIND , & found );
26312638 if (dbentry == NULL )
26322639 {
@@ -2648,8 +2655,8 @@ pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len)
26482655 */
26492656 for (i = 0 ; i < msg -> m_nentries ; i ++ )
26502657 {
2651- tabentry = (PgStat_StatTabEntry * )hash_search (dbentry -> tables ,
2652- (char * )& (msg -> m_tableid [i ]),
2658+ tabentry = (PgStat_StatTabEntry * ) hash_search (dbentry -> tables ,
2659+ (void * ) & (msg -> m_tableid [i ]),
26532660 HASH_FIND , & found );
26542661 if (tabentry == NULL )
26552662 {
@@ -2685,8 +2692,8 @@ pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len)
26852692 /*
26862693 * Lookup the database in the hashtable.
26872694 */
2688- dbentry = (PgStat_StatDBEntry * )hash_search (pgStatDBHash ,
2689- (char * )& (msg -> m_databaseid ),
2695+ dbentry = (PgStat_StatDBEntry * ) hash_search (pgStatDBHash ,
2696+ (void * ) & (msg -> m_databaseid ),
26902697 HASH_FIND , & found );
26912698 if (dbentry == NULL )
26922699 {
@@ -2725,8 +2732,8 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
27252732 /*
27262733 * Lookup the database in the hashtable.
27272734 */
2728- dbentry = (PgStat_StatDBEntry * )hash_search (pgStatDBHash ,
2729- (char * )& (msg -> m_hdr .m_databaseid ),
2735+ dbentry = (PgStat_StatDBEntry * ) hash_search (pgStatDBHash ,
2736+ (void * ) & (msg -> m_hdr .m_databaseid ),
27302737 HASH_FIND , & found );
27312738 if (dbentry == NULL )
27322739 {
@@ -2753,7 +2760,7 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
27532760
27542761 memset (& hash_ctl , 0 , sizeof (hash_ctl ));
27552762 hash_ctl .keysize = sizeof (Oid );
2756- hash_ctl .datasize = sizeof (PgStat_StatTabEntry );
2763+ hash_ctl .entrysize = sizeof (PgStat_StatTabEntry );
27572764 hash_ctl .hash = tag_hash ;
27582765 dbentry -> tables = hash_create (PGSTAT_TAB_HASH_SIZE , & hash_ctl ,
27592766 HASH_ELEM | HASH_FUNCTION );
0 commit comments