[ Oleg, I've CC'd you because this patch makes some modifications,
albeit trivial ones, to tsearch2; let me know if you object to me
applying it ]

This patch makes some cleanups to contrib/ to silence some sparse
warnings:

- remove pointless "extern" keyword from some function definitions in
contrib/tsearch2

- use "NULL" not "0" as NULL pointer in contrib/tsearch,
contrib/tsearch2, contrib/pgbench, and contrib/vacuumlo

Barring any objections I will apply this tomorrow.

-Neil

--- contrib/pgbench/pgbench.c
+++ contrib/pgbench/pgbench.c
@@ -268,7 +268,7 @@
 					double		diff;
 					struct timeval now;
 
-					gettimeofday(&now, 0);
+					gettimeofday(&now, NULL);
 					diff = (int) (now.tv_sec - st->txn_begin.tv_sec) * 1000000.0 +
 						(int) (now.tv_usec - st->txn_begin.tv_usec);
 
@@ -328,7 +328,7 @@
 			st->tid = getrand(1, ntellers * tps);
 			st->delta = getrand(1, 1000);
 			if (use_log)
-				gettimeofday(&(st->txn_begin), 0);
+				gettimeofday(&(st->txn_begin), NULL);
 			break;
 		case 1:
 			snprintf(sql, 256, "update accounts set abalance = abalance + %d where aid = %d\n", st->delta, st->aid);
@@ -938,11 +938,11 @@
 	PQfinish(con);
 
 	/* set random seed */
-	gettimeofday(&tv1, 0);
+	gettimeofday(&tv1, NULL);
 	srand((unsigned int) tv1.tv_usec);
 
 	/* get start up time */
-	gettimeofday(&tv1, 0);
+	gettimeofday(&tv1, NULL);
 
 	if (is_connect == 0)
 	{
@@ -956,7 +956,7 @@
 	}
 
 	/* time after connections set up */
-	gettimeofday(&tv2, 0);
+	gettimeofday(&tv2, NULL);
 
 	/* send start up queries in async manner */
 	for (i = 0; i < nclients; i++)
@@ -973,7 +973,7 @@
 		{						/* all done ? */
 			disconnect_all(state);
 			/* get end time */
-			gettimeofday(&tv3, 0);
+			gettimeofday(&tv3, NULL);
 			printResults(ttype, state, &tv1, &tv2, &tv3);
 			if (LOGFILE)
 				fclose(LOGFILE);
--- contrib/tsearch/query.c
+++ contrib/tsearch/query.c
@@ -259,7 +259,7 @@
 			pfree(lemm);
 		}
 		else
-			pushval_asis(state, VALTRUE, 0, 0);
+			pushval_asis(state, VALTRUE, NULL, 0);
 		if (count)
 			pushquery(state, OPR, (int4) '&', 0, 0);
 		count++;
--- contrib/tsearch2/query.c
+++ contrib/tsearch2/query.c
@@ -284,7 +284,7 @@
 
 	/* XXX */
 	if (prs.curwords == 0)
-		pushval_asis(state, VALSTOP, 0, 0, 0);
+		pushval_asis(state, VALSTOP, NULL, 0, 0);
 }
 
 #define STACKDEPTH	32
--- contrib/tsearch2/snowball/api.c
+++ contrib/tsearch2/snowball/api.c
@@ -1,8 +1,8 @@
 #include <stdlib.h>
 
 #include "header.h"
 
-extern struct SN_env *
+struct SN_env *
 SN_create_env(int S_size, int I_size, int B_size)
 {
 	struct SN_env *z = (struct SN_env *) calloc(1, sizeof(struct SN_env));
@@ -59,7 +59,7 @@
 	return z;
 }
 
-extern void
+void
 SN_close_env(struct SN_env * z)
 {
 	if (z->S && z->S_size)
@@ -81,7 +81,7 @@
 	free(z);
 }
 
-extern void
+void
 SN_set_current(struct SN_env * z, int size, const symbol * s)
 {
 	replace_s(z, 0, z->l, size, s);
--- contrib/tsearch2/snowball/utilities.c
+++ contrib/tsearch2/snowball/utilities.c
@@ -9,7 +9,7 @@
 
 #define CREATE_SIZE 1
 
-extern symbol *
+symbol *
 create_s(void)
 {
 	symbol	   *p = (symbol *) (HEAD + (char *) malloc(HEAD + (CREATE_SIZE + 1) * sizeof(symbol)));
@@ -21,13 +21,13 @@
 	return p;
 }
 
-extern void
+void
 lose_s(symbol * p)
 {
 	free((char *) p - HEAD);
 }
 
-extern int
+int
 in_grouping(struct SN_env * z, unsigned char *s, int min, int max)
 {
 	if (z->c >= z->l)
@@ -44,7 +44,7 @@
 	return 1;
 }
 
-extern int
+int
 in_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
 {
 	if (z->c <= z->lb)
@@ -61,7 +61,7 @@
 	return 1;
 }
 
-extern int
+int
 out_grouping(struct SN_env * z, unsigned char *s, int min, int max)
 {
 	if (z->c >= z->l)
@@ -77,7 +77,7 @@
 	return 1;
 }
 
-extern int
+int
 out_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
 {
 	if (z->c <= z->lb)
@@ -94,7 +94,7 @@
 }
 
 
-extern int
+int
 in_range(struct SN_env * z, int min, int max)
 {
 	if (z->c >= z->l)
@@ -110,7 +110,7 @@
 	return 1;
 }
 
-extern int
+int
 in_range_b(struct SN_env * z, int min, int max)
 {
 	if (z->c <= z->lb)
@@ -126,7 +126,7 @@
 	return 1;
 }
 
-extern int
+int
 out_range(struct SN_env * z, int min, int max)
 {
 	if (z->c >= z->l)
@@ -141,7 +141,7 @@
 	return 1;
 }
 
-extern int
+int
 out_range_b(struct SN_env * z, int min, int max)
 {
 	if (z->c <= z->lb)
@@ -156,7 +156,7 @@
 	return 1;
 }
 
-extern int
+int
 eq_s(struct SN_env * z, int s_size, symbol * s)
 {
 	if (z->l - z->c < s_size ||
@@ -166,7 +166,7 @@
 	return 1;
 }
 
-extern int
+int
 eq_s_b(struct SN_env * z, int s_size, symbol * s)
 {
 	if (z->c - z->lb < s_size ||
@@ -176,19 +176,19 @@
 	return 1;
 }
 
-extern int
+int
 eq_v(struct SN_env * z, symbol * p)
 {
 	return eq_s(z, SIZE(p), p);
 }
 
-extern int
+int
 eq_v_b(struct SN_env * z, symbol * p)
 {
 	return eq_s_b(z, SIZE(p), p);
 }
 
-extern int
+int
 find_among(struct SN_env * z, struct among * v, int v_size)
 {
 	int			i = 0;
@@ -280,7 +280,7 @@
 
 /* find_among_b is for backwards processing. Same comments apply */
 
-extern int
+int
 find_among_b(struct SN_env * z, struct among * v, int v_size)
 {
 	int			i = 0;
@@ -364,7 +364,7 @@
 }
 
 
-extern symbol *
+symbol *
 increase_size(symbol * p, int n)
 {
 	int			new_size = n + 20;
@@ -380,7 +380,7 @@
    s_size symbols at s
 */
 
-extern int
+int
 replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s)
 {
 	int			adjustment = s_size - (c_ket - c_bra);
@@ -416,26 +416,26 @@
 	}
 }
 
-extern void
+void
 slice_from_s(struct SN_env * z, int s_size, symbol * s)
 {
 	slice_check(z);
 	replace_s(z, z->bra, z->ket, s_size, s);
 }
 
-extern void
+void
 slice_from_v(struct SN_env * z, symbol * p)
 {
 	slice_from_s(z, SIZE(p), p);
 }
 
-extern void
+void
 slice_del(struct SN_env * z)
 {
-	slice_from_s(z, 0, 0);
+	slice_from_s(z, 0, NULL);
 }
 
-extern void
+void
 insert_s(struct SN_env * z, int bra, int ket, int s_size, symbol * s)
 {
 	int			adjustment = replace_s(z, bra, ket, s_size, s);
@@ -446,7 +446,7 @@
 		z->ket += adjustment;
 }
 
-extern void
+void
 insert_v(struct SN_env * z, int bra, int ket, symbol * p)
 {
 	int			adjustment = replace_s(z, bra, ket, SIZE(p), p);
@@ -457,7 +457,7 @@
 		z->ket += adjustment;
 }
 
-extern symbol *
+symbol *
 slice_to(struct SN_env * z, symbol * p)
 {
 	slice_check(z);
@@ -472,7 +472,7 @@
 	return p;
 }
 
-extern symbol *
+symbol *
 assign_to(struct SN_env * z, symbol * p)
 {
 	int			len = z->l;
@@ -484,7 +484,7 @@
 	return p;
 }
 
-extern void
+void
 debug(struct SN_env * z, int number, int line_count)
 {
 	int			i;
--- contrib/vacuumlo/vacuumlo.c
+++ contrib/vacuumlo/vacuumlo.c
@@ -309,7 +309,7 @@
 	param.pg_user = NULL;
 	param.pg_prompt = 0;
 	param.pg_host = NULL;
-	param.pg_port = 0;
+	param.pg_port = NULL;
 	param.verbose = 0;
 	param.dry_run = 0;
 
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to