Commit 1b3e7696 authored by Neil Conway's avatar Neil Conway

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
parent 53ee0729
/* /*
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.34 2004/10/25 02:15:01 tgl Exp $ * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.35 2004/11/09 06:09:31 neilc Exp $
* *
* pgbench: a simple TPC-B like benchmark program for PostgreSQL * pgbench: a simple TPC-B like benchmark program for PostgreSQL
* written by Tatsuo Ishii * written by Tatsuo Ishii
...@@ -268,7 +268,7 @@ doOne(CState * state, int n, int debug, int ttype) ...@@ -268,7 +268,7 @@ doOne(CState * state, int n, int debug, int ttype)
double diff; double diff;
struct timeval now; struct timeval now;
gettimeofday(&now, 0); gettimeofday(&now, NULL);
diff = (int) (now.tv_sec - st->txn_begin.tv_sec) * 1000000.0 + diff = (int) (now.tv_sec - st->txn_begin.tv_sec) * 1000000.0 +
(int) (now.tv_usec - st->txn_begin.tv_usec); (int) (now.tv_usec - st->txn_begin.tv_usec);
...@@ -328,7 +328,7 @@ doOne(CState * state, int n, int debug, int ttype) ...@@ -328,7 +328,7 @@ doOne(CState * state, int n, int debug, int ttype)
st->tid = getrand(1, ntellers * tps); st->tid = getrand(1, ntellers * tps);
st->delta = getrand(1, 1000); st->delta = getrand(1, 1000);
if (use_log) if (use_log)
gettimeofday(&(st->txn_begin), 0); gettimeofday(&(st->txn_begin), NULL);
break; break;
case 1: case 1:
snprintf(sql, 256, "update accounts set abalance = abalance + %d where aid = %d\n", st->delta, st->aid); snprintf(sql, 256, "update accounts set abalance = abalance + %d where aid = %d\n", st->delta, st->aid);
...@@ -938,11 +938,11 @@ main(int argc, char **argv) ...@@ -938,11 +938,11 @@ main(int argc, char **argv)
PQfinish(con); PQfinish(con);
/* set random seed */ /* set random seed */
gettimeofday(&tv1, 0); gettimeofday(&tv1, NULL);
srand((unsigned int) tv1.tv_usec); srand((unsigned int) tv1.tv_usec);
/* get start up time */ /* get start up time */
gettimeofday(&tv1, 0); gettimeofday(&tv1, NULL);
if (is_connect == 0) if (is_connect == 0)
{ {
...@@ -956,7 +956,7 @@ main(int argc, char **argv) ...@@ -956,7 +956,7 @@ main(int argc, char **argv)
} }
/* time after connections set up */ /* time after connections set up */
gettimeofday(&tv2, 0); gettimeofday(&tv2, NULL);
/* send start up queries in async manner */ /* send start up queries in async manner */
for (i = 0; i < nclients; i++) for (i = 0; i < nclients; i++)
...@@ -973,7 +973,7 @@ main(int argc, char **argv) ...@@ -973,7 +973,7 @@ main(int argc, char **argv)
{ /* all done ? */ { /* all done ? */
disconnect_all(state); disconnect_all(state);
/* get end time */ /* get end time */
gettimeofday(&tv3, 0); gettimeofday(&tv3, NULL);
printResults(ttype, state, &tv1, &tv2, &tv3); printResults(ttype, state, &tv1, &tv2, &tv3);
if (LOGFILE) if (LOGFILE)
fclose(LOGFILE); fclose(LOGFILE);
......
...@@ -259,7 +259,7 @@ pushval_morph(QPRS_STATE * state, int typeval, char *strval, int lenval) ...@@ -259,7 +259,7 @@ pushval_morph(QPRS_STATE * state, int typeval, char *strval, int lenval)
pfree(lemm); pfree(lemm);
} }
else else
pushval_asis(state, VALTRUE, 0, 0); pushval_asis(state, VALTRUE, NULL, 0);
if (count) if (count)
pushquery(state, OPR, (int4) '&', 0, 0); pushquery(state, OPR, (int4) '&', 0, 0);
count++; count++;
......
...@@ -284,7 +284,7 @@ pushval_morph(QPRS_STATE * state, int typeval, char *strval, int lenval, int2 we ...@@ -284,7 +284,7 @@ pushval_morph(QPRS_STATE * state, int typeval, char *strval, int lenval, int2 we
/* XXX */ /* XXX */
if (prs.curwords == 0) if (prs.curwords == 0)
pushval_asis(state, VALSTOP, 0, 0, 0); pushval_asis(state, VALSTOP, NULL, 0, 0);
} }
#define STACKDEPTH 32 #define STACKDEPTH 32
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "header.h" #include "header.h"
extern struct SN_env * struct SN_env *
SN_create_env(int S_size, int I_size, int B_size) 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)); struct SN_env *z = (struct SN_env *) calloc(1, sizeof(struct SN_env));
...@@ -59,7 +59,7 @@ SN_create_env(int S_size, int I_size, int B_size) ...@@ -59,7 +59,7 @@ SN_create_env(int S_size, int I_size, int B_size)
return z; return z;
} }
extern void void
SN_close_env(struct SN_env * z) SN_close_env(struct SN_env * z)
{ {
if (z->S && z->S_size) if (z->S && z->S_size)
...@@ -81,7 +81,7 @@ SN_close_env(struct SN_env * z) ...@@ -81,7 +81,7 @@ SN_close_env(struct SN_env * z)
free(z); free(z);
} }
extern void void
SN_set_current(struct SN_env * z, int size, const symbol * s) SN_set_current(struct SN_env * z, int size, const symbol * s)
{ {
replace_s(z, 0, z->l, size, s); replace_s(z, 0, z->l, size, s);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define CREATE_SIZE 1 #define CREATE_SIZE 1
extern symbol * symbol *
create_s(void) create_s(void)
{ {
symbol *p = (symbol *) (HEAD + (char *) malloc(HEAD + (CREATE_SIZE + 1) * sizeof(symbol))); symbol *p = (symbol *) (HEAD + (char *) malloc(HEAD + (CREATE_SIZE + 1) * sizeof(symbol)));
...@@ -21,13 +21,13 @@ create_s(void) ...@@ -21,13 +21,13 @@ create_s(void)
return p; return p;
} }
extern void void
lose_s(symbol * p) lose_s(symbol * p)
{ {
free((char *) p - HEAD); free((char *) p - HEAD);
} }
extern int int
in_grouping(struct SN_env * z, unsigned char *s, int min, int max) in_grouping(struct SN_env * z, unsigned char *s, int min, int max)
{ {
if (z->c >= z->l) if (z->c >= z->l)
...@@ -44,7 +44,7 @@ in_grouping(struct SN_env * z, unsigned char *s, int min, int max) ...@@ -44,7 +44,7 @@ in_grouping(struct SN_env * z, unsigned char *s, int min, int max)
return 1; return 1;
} }
extern int int
in_grouping_b(struct SN_env * z, unsigned char *s, int min, int max) in_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
{ {
if (z->c <= z->lb) if (z->c <= z->lb)
...@@ -61,7 +61,7 @@ in_grouping_b(struct SN_env * z, unsigned char *s, int min, int max) ...@@ -61,7 +61,7 @@ in_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
return 1; return 1;
} }
extern int int
out_grouping(struct SN_env * z, unsigned char *s, int min, int max) out_grouping(struct SN_env * z, unsigned char *s, int min, int max)
{ {
if (z->c >= z->l) if (z->c >= z->l)
...@@ -77,7 +77,7 @@ out_grouping(struct SN_env * z, unsigned char *s, int min, int max) ...@@ -77,7 +77,7 @@ out_grouping(struct SN_env * z, unsigned char *s, int min, int max)
return 1; return 1;
} }
extern int int
out_grouping_b(struct SN_env * z, unsigned char *s, int min, int max) out_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
{ {
if (z->c <= z->lb) if (z->c <= z->lb)
...@@ -94,7 +94,7 @@ out_grouping_b(struct SN_env * z, unsigned char *s, int min, int max) ...@@ -94,7 +94,7 @@ out_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
} }
extern int int
in_range(struct SN_env * z, int min, int max) in_range(struct SN_env * z, int min, int max)
{ {
if (z->c >= z->l) if (z->c >= z->l)
...@@ -110,7 +110,7 @@ in_range(struct SN_env * z, int min, int max) ...@@ -110,7 +110,7 @@ in_range(struct SN_env * z, int min, int max)
return 1; return 1;
} }
extern int int
in_range_b(struct SN_env * z, int min, int max) in_range_b(struct SN_env * z, int min, int max)
{ {
if (z->c <= z->lb) if (z->c <= z->lb)
...@@ -126,7 +126,7 @@ in_range_b(struct SN_env * z, int min, int max) ...@@ -126,7 +126,7 @@ in_range_b(struct SN_env * z, int min, int max)
return 1; return 1;
} }
extern int int
out_range(struct SN_env * z, int min, int max) out_range(struct SN_env * z, int min, int max)
{ {
if (z->c >= z->l) if (z->c >= z->l)
...@@ -141,7 +141,7 @@ out_range(struct SN_env * z, int min, int max) ...@@ -141,7 +141,7 @@ out_range(struct SN_env * z, int min, int max)
return 1; return 1;
} }
extern int int
out_range_b(struct SN_env * z, int min, int max) out_range_b(struct SN_env * z, int min, int max)
{ {
if (z->c <= z->lb) if (z->c <= z->lb)
...@@ -156,7 +156,7 @@ out_range_b(struct SN_env * z, int min, int max) ...@@ -156,7 +156,7 @@ out_range_b(struct SN_env * z, int min, int max)
return 1; return 1;
} }
extern int int
eq_s(struct SN_env * z, int s_size, symbol * s) eq_s(struct SN_env * z, int s_size, symbol * s)
{ {
if (z->l - z->c < s_size || if (z->l - z->c < s_size ||
...@@ -166,7 +166,7 @@ eq_s(struct SN_env * z, int s_size, symbol * s) ...@@ -166,7 +166,7 @@ eq_s(struct SN_env * z, int s_size, symbol * s)
return 1; return 1;
} }
extern int int
eq_s_b(struct SN_env * z, int s_size, symbol * s) eq_s_b(struct SN_env * z, int s_size, symbol * s)
{ {
if (z->c - z->lb < s_size || if (z->c - z->lb < s_size ||
...@@ -176,19 +176,19 @@ eq_s_b(struct SN_env * z, int s_size, symbol * s) ...@@ -176,19 +176,19 @@ eq_s_b(struct SN_env * z, int s_size, symbol * s)
return 1; return 1;
} }
extern int int
eq_v(struct SN_env * z, symbol * p) eq_v(struct SN_env * z, symbol * p)
{ {
return eq_s(z, SIZE(p), p); return eq_s(z, SIZE(p), p);
} }
extern int int
eq_v_b(struct SN_env * z, symbol * p) eq_v_b(struct SN_env * z, symbol * p)
{ {
return eq_s_b(z, SIZE(p), p); return eq_s_b(z, SIZE(p), p);
} }
extern int int
find_among(struct SN_env * z, struct among * v, int v_size) find_among(struct SN_env * z, struct among * v, int v_size)
{ {
int i = 0; int i = 0;
...@@ -280,7 +280,7 @@ find_among(struct SN_env * z, struct among * v, int v_size) ...@@ -280,7 +280,7 @@ find_among(struct SN_env * z, struct among * v, int v_size)
/* find_among_b is for backwards processing. Same comments apply */ /* 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) find_among_b(struct SN_env * z, struct among * v, int v_size)
{ {
int i = 0; int i = 0;
...@@ -364,7 +364,7 @@ find_among_b(struct SN_env * z, struct among * v, int v_size) ...@@ -364,7 +364,7 @@ find_among_b(struct SN_env * z, struct among * v, int v_size)
} }
extern symbol * symbol *
increase_size(symbol * p, int n) increase_size(symbol * p, int n)
{ {
int new_size = n + 20; int new_size = n + 20;
...@@ -380,7 +380,7 @@ increase_size(symbol * p, int n) ...@@ -380,7 +380,7 @@ increase_size(symbol * p, int n)
s_size symbols at s 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) 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); int adjustment = s_size - (c_ket - c_bra);
...@@ -416,26 +416,26 @@ slice_check(struct SN_env * z) ...@@ -416,26 +416,26 @@ slice_check(struct SN_env * z)
} }
} }
extern void void
slice_from_s(struct SN_env * z, int s_size, symbol * s) slice_from_s(struct SN_env * z, int s_size, symbol * s)
{ {
slice_check(z); slice_check(z);
replace_s(z, z->bra, z->ket, s_size, s); replace_s(z, z->bra, z->ket, s_size, s);
} }
extern void void
slice_from_v(struct SN_env * z, symbol * p) slice_from_v(struct SN_env * z, symbol * p)
{ {
slice_from_s(z, SIZE(p), p); slice_from_s(z, SIZE(p), p);
} }
extern void void
slice_del(struct SN_env * z) 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) 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); int adjustment = replace_s(z, bra, ket, s_size, s);
...@@ -446,7 +446,7 @@ insert_s(struct SN_env * z, int bra, int ket, int s_size, symbol * s) ...@@ -446,7 +446,7 @@ insert_s(struct SN_env * z, int bra, int ket, int s_size, symbol * s)
z->ket += adjustment; z->ket += adjustment;
} }
extern void void
insert_v(struct SN_env * z, int bra, int ket, symbol * p) insert_v(struct SN_env * z, int bra, int ket, symbol * p)
{ {
int adjustment = replace_s(z, bra, ket, SIZE(p), p); int adjustment = replace_s(z, bra, ket, SIZE(p), p);
...@@ -457,7 +457,7 @@ insert_v(struct SN_env * z, int bra, int ket, symbol * p) ...@@ -457,7 +457,7 @@ insert_v(struct SN_env * z, int bra, int ket, symbol * p)
z->ket += adjustment; z->ket += adjustment;
} }
extern symbol * symbol *
slice_to(struct SN_env * z, symbol * p) slice_to(struct SN_env * z, symbol * p)
{ {
slice_check(z); slice_check(z);
...@@ -472,7 +472,7 @@ slice_to(struct SN_env * z, symbol * p) ...@@ -472,7 +472,7 @@ slice_to(struct SN_env * z, symbol * p)
return p; return p;
} }
extern symbol * symbol *
assign_to(struct SN_env * z, symbol * p) assign_to(struct SN_env * z, symbol * p)
{ {
int len = z->l; int len = z->l;
...@@ -484,7 +484,7 @@ assign_to(struct SN_env * z, symbol * p) ...@@ -484,7 +484,7 @@ assign_to(struct SN_env * z, symbol * p)
return p; return p;
} }
extern void void
debug(struct SN_env * z, int number, int line_count) debug(struct SN_env * z, int number, int line_count)
{ {
int i; int i;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.27 2004/08/29 04:12:17 momjian Exp $ * $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.28 2004/11/09 06:09:40 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -309,7 +309,7 @@ main(int argc, char **argv) ...@@ -309,7 +309,7 @@ main(int argc, char **argv)
param.pg_user = NULL; param.pg_user = NULL;
param.pg_prompt = 0; param.pg_prompt = 0;
param.pg_host = NULL; param.pg_host = NULL;
param.pg_port = 0; param.pg_port = NULL;
param.verbose = 0; param.verbose = 0;
param.dry_run = 0; param.dry_run = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment