Skip to content

Commit 1b3e769

Browse files
author
Neil Conway
committed
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
1 parent 53ee072 commit 1b3e769

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

contrib/pgbench/pgbench.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.34 2004/10/25 02:15:01 tgl Exp $
2+
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.35 2004/11/09 06:09:31 neilc Exp $
33
*
44
* pgbench: a simple TPC-B like benchmark program for PostgreSQL
55
* written by Tatsuo Ishii
@@ -268,7 +268,7 @@ doOne(CState * state, int n, int debug, int ttype)
268268
double diff;
269269
struct timeval now;
270270

271-
gettimeofday(&now, 0);
271+
gettimeofday(&now, NULL);
272272
diff = (int) (now.tv_sec - st->txn_begin.tv_sec) * 1000000.0 +
273273
(int) (now.tv_usec - st->txn_begin.tv_usec);
274274

@@ -328,7 +328,7 @@ doOne(CState * state, int n, int debug, int ttype)
328328
st->tid = getrand(1, ntellers * tps);
329329
st->delta = getrand(1, 1000);
330330
if (use_log)
331-
gettimeofday(&(st->txn_begin), 0);
331+
gettimeofday(&(st->txn_begin), NULL);
332332
break;
333333
case 1:
334334
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)
938938
PQfinish(con);
939939

940940
/* set random seed */
941-
gettimeofday(&tv1, 0);
941+
gettimeofday(&tv1, NULL);
942942
srand((unsigned int) tv1.tv_usec);
943943

944944
/* get start up time */
945-
gettimeofday(&tv1, 0);
945+
gettimeofday(&tv1, NULL);
946946

947947
if (is_connect == 0)
948948
{
@@ -956,7 +956,7 @@ main(int argc, char **argv)
956956
}
957957

958958
/* time after connections set up */
959-
gettimeofday(&tv2, 0);
959+
gettimeofday(&tv2, NULL);
960960

961961
/* send start up queries in async manner */
962962
for (i = 0; i < nclients; i++)
@@ -973,7 +973,7 @@ main(int argc, char **argv)
973973
{ /* all done ? */
974974
disconnect_all(state);
975975
/* get end time */
976-
gettimeofday(&tv3, 0);
976+
gettimeofday(&tv3, NULL);
977977
printResults(ttype, state, &tv1, &tv2, &tv3);
978978
if (LOGFILE)
979979
fclose(LOGFILE);

contrib/tsearch/query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pushval_morph(QPRS_STATE * state, int typeval, char *strval, int lenval)
259259
pfree(lemm);
260260
}
261261
else
262-
pushval_asis(state, VALTRUE, 0, 0);
262+
pushval_asis(state, VALTRUE, NULL, 0);
263263
if (count)
264264
pushquery(state, OPR, (int4) '&', 0, 0);
265265
count++;

contrib/tsearch2/query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pushval_morph(QPRS_STATE * state, int typeval, char *strval, int lenval, int2 we
284284

285285
/* XXX */
286286
if (prs.curwords == 0)
287-
pushval_asis(state, VALSTOP, 0, 0, 0);
287+
pushval_asis(state, VALSTOP, NULL, 0, 0);
288288
}
289289

290290
#define STACKDEPTH 32

contrib/tsearch2/snowball/api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "header.h"
44

5-
extern struct SN_env *
5+
struct SN_env *
66
SN_create_env(int S_size, int I_size, int B_size)
77
{
88
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)
5959
return z;
6060
}
6161

62-
extern void
62+
void
6363
SN_close_env(struct SN_env * z)
6464
{
6565
if (z->S && z->S_size)
@@ -81,7 +81,7 @@ SN_close_env(struct SN_env * z)
8181
free(z);
8282
}
8383

84-
extern void
84+
void
8585
SN_set_current(struct SN_env * z, int size, const symbol * s)
8686
{
8787
replace_s(z, 0, z->l, size, s);

contrib/tsearch2/snowball/utilities.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#define CREATE_SIZE 1
1111

12-
extern symbol *
12+
symbol *
1313
create_s(void)
1414
{
1515
symbol *p = (symbol *) (HEAD + (char *) malloc(HEAD + (CREATE_SIZE + 1) * sizeof(symbol)));
@@ -21,13 +21,13 @@ create_s(void)
2121
return p;
2222
}
2323

24-
extern void
24+
void
2525
lose_s(symbol * p)
2626
{
2727
free((char *) p - HEAD);
2828
}
2929

30-
extern int
30+
int
3131
in_grouping(struct SN_env * z, unsigned char *s, int min, int max)
3232
{
3333
if (z->c >= z->l)
@@ -44,7 +44,7 @@ in_grouping(struct SN_env * z, unsigned char *s, int min, int max)
4444
return 1;
4545
}
4646

47-
extern int
47+
int
4848
in_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
4949
{
5050
if (z->c <= z->lb)
@@ -61,7 +61,7 @@ in_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
6161
return 1;
6262
}
6363

64-
extern int
64+
int
6565
out_grouping(struct SN_env * z, unsigned char *s, int min, int max)
6666
{
6767
if (z->c >= z->l)
@@ -77,7 +77,7 @@ out_grouping(struct SN_env * z, unsigned char *s, int min, int max)
7777
return 1;
7878
}
7979

80-
extern int
80+
int
8181
out_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
8282
{
8383
if (z->c <= z->lb)
@@ -94,7 +94,7 @@ out_grouping_b(struct SN_env * z, unsigned char *s, int min, int max)
9494
}
9595

9696

97-
extern int
97+
int
9898
in_range(struct SN_env * z, int min, int max)
9999
{
100100
if (z->c >= z->l)
@@ -110,7 +110,7 @@ in_range(struct SN_env * z, int min, int max)
110110
return 1;
111111
}
112112

113-
extern int
113+
int
114114
in_range_b(struct SN_env * z, int min, int max)
115115
{
116116
if (z->c <= z->lb)
@@ -126,7 +126,7 @@ in_range_b(struct SN_env * z, int min, int max)
126126
return 1;
127127
}
128128

129-
extern int
129+
int
130130
out_range(struct SN_env * z, int min, int max)
131131
{
132132
if (z->c >= z->l)
@@ -141,7 +141,7 @@ out_range(struct SN_env * z, int min, int max)
141141
return 1;
142142
}
143143

144-
extern int
144+
int
145145
out_range_b(struct SN_env * z, int min, int max)
146146
{
147147
if (z->c <= z->lb)
@@ -156,7 +156,7 @@ out_range_b(struct SN_env * z, int min, int max)
156156
return 1;
157157
}
158158

159-
extern int
159+
int
160160
eq_s(struct SN_env * z, int s_size, symbol * s)
161161
{
162162
if (z->l - z->c < s_size ||
@@ -166,7 +166,7 @@ eq_s(struct SN_env * z, int s_size, symbol * s)
166166
return 1;
167167
}
168168

169-
extern int
169+
int
170170
eq_s_b(struct SN_env * z, int s_size, symbol * s)
171171
{
172172
if (z->c - z->lb < s_size ||
@@ -176,19 +176,19 @@ eq_s_b(struct SN_env * z, int s_size, symbol * s)
176176
return 1;
177177
}
178178

179-
extern int
179+
int
180180
eq_v(struct SN_env * z, symbol * p)
181181
{
182182
return eq_s(z, SIZE(p), p);
183183
}
184184

185-
extern int
185+
int
186186
eq_v_b(struct SN_env * z, symbol * p)
187187
{
188188
return eq_s_b(z, SIZE(p), p);
189189
}
190190

191-
extern int
191+
int
192192
find_among(struct SN_env * z, struct among * v, int v_size)
193193
{
194194
int i = 0;
@@ -280,7 +280,7 @@ find_among(struct SN_env * z, struct among * v, int v_size)
280280

281281
/* find_among_b is for backwards processing. Same comments apply */
282282

283-
extern int
283+
int
284284
find_among_b(struct SN_env * z, struct among * v, int v_size)
285285
{
286286
int i = 0;
@@ -364,7 +364,7 @@ find_among_b(struct SN_env * z, struct among * v, int v_size)
364364
}
365365

366366

367-
extern symbol *
367+
symbol *
368368
increase_size(symbol * p, int n)
369369
{
370370
int new_size = n + 20;
@@ -380,7 +380,7 @@ increase_size(symbol * p, int n)
380380
s_size symbols at s
381381
*/
382382

383-
extern int
383+
int
384384
replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s)
385385
{
386386
int adjustment = s_size - (c_ket - c_bra);
@@ -416,26 +416,26 @@ slice_check(struct SN_env * z)
416416
}
417417
}
418418

419-
extern void
419+
void
420420
slice_from_s(struct SN_env * z, int s_size, symbol * s)
421421
{
422422
slice_check(z);
423423
replace_s(z, z->bra, z->ket, s_size, s);
424424
}
425425

426-
extern void
426+
void
427427
slice_from_v(struct SN_env * z, symbol * p)
428428
{
429429
slice_from_s(z, SIZE(p), p);
430430
}
431431

432-
extern void
432+
void
433433
slice_del(struct SN_env * z)
434434
{
435-
slice_from_s(z, 0, 0);
435+
slice_from_s(z, 0, NULL);
436436
}
437437

438-
extern void
438+
void
439439
insert_s(struct SN_env * z, int bra, int ket, int s_size, symbol * s)
440440
{
441441
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)
446446
z->ket += adjustment;
447447
}
448448

449-
extern void
449+
void
450450
insert_v(struct SN_env * z, int bra, int ket, symbol * p)
451451
{
452452
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)
457457
z->ket += adjustment;
458458
}
459459

460-
extern symbol *
460+
symbol *
461461
slice_to(struct SN_env * z, symbol * p)
462462
{
463463
slice_check(z);
@@ -472,7 +472,7 @@ slice_to(struct SN_env * z, symbol * p)
472472
return p;
473473
}
474474

475-
extern symbol *
475+
symbol *
476476
assign_to(struct SN_env * z, symbol * p)
477477
{
478478
int len = z->l;
@@ -484,7 +484,7 @@ assign_to(struct SN_env * z, symbol * p)
484484
return p;
485485
}
486486

487-
extern void
487+
void
488488
debug(struct SN_env * z, int number, int line_count)
489489
{
490490
int i;

contrib/vacuumlo/vacuumlo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.27 2004/08/29 04:12:17 momjian Exp $
11+
* $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.28 2004/11/09 06:09:40 neilc Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -309,7 +309,7 @@ main(int argc, char **argv)
309309
param.pg_user = NULL;
310310
param.pg_prompt = 0;
311311
param.pg_host = NULL;
312-
param.pg_port = 0;
312+
param.pg_port = NULL;
313313
param.verbose = 0;
314314
param.dry_run = 0;
315315

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy