Re: [PATCHES] contrib/ sparse code cleanup

2004-11-08 Thread Neil Conway
On Fri, 2004-11-05 at 15:21, Neil Conway wrote:
> This patch makes some cleanups to contrib/ to silence some sparse
> warnings

Applied.

-Neil



---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [PATCHES] contrib/ sparse code cleanup

2004-11-05 Thread Oleg Bartunov
Neil,
go ahead !
Oleg
On Fri, 5 Nov 2004, Neil Conway wrote:
[ 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

Regards,
Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match


[PATCHES] contrib/ sparse code cleanup

2004-11-04 Thread Neil Conway
[ 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) * 100.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 
 
 #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