Skip to content

Commit 0631059

Browse files
committed
Fix unportable struct initializations.
1 parent 2c19629 commit 0631059

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

contrib/pgbench/pgbench.c

Lines changed: 9 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.43 2005/10/15 02:49:06 momjian Exp $
2+
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.44 2005/10/15 20:24:00 tgl Exp $
33
*
44
* pgbench: a simple benchmark program for PostgreSQL
55
* written by Tatsuo Ishii
@@ -260,12 +260,14 @@ compareVariables(const void *v1, const void *v2)
260260
static char *
261261
getVariable(CState * st, char *name)
262262
{
263-
Variable key = {name}, *var;
263+
Variable key,
264+
*var;
264265

265266
/* On some versions of Solaris, bsearch of zero items dumps core */
266267
if (st->nvariables <= 0)
267268
return NULL;
268269

270+
key.name = name;
269271
var = (Variable *) bsearch((void *) &key,
270272
(void *) st->variables,
271273
st->nvariables,
@@ -280,8 +282,10 @@ getVariable(CState * st, char *name)
280282
static int
281283
putVariable(CState * st, char *name, char *value)
282284
{
283-
Variable key = {name}, *var;
285+
Variable key,
286+
*var;
284287

288+
key.name = name;
285289
/* On some versions of Solaris, bsearch of zero items dumps core */
286290
if (st->nvariables > 0)
287291
var = (Variable *) bsearch((void *) &key,
@@ -1093,11 +1097,10 @@ main(int argc, char **argv)
10931097
#if !(defined(__CYGWIN__) || defined(__MINGW32__))
10941098
#ifdef RLIMIT_NOFILE /* most platform uses RLIMIT_NOFILE */
10951099
if (getrlimit(RLIMIT_NOFILE, &rlim) == -1)
1096-
{
10971100
#else /* but BSD doesn't ... */
10981101
if (getrlimit(RLIMIT_OFILE, &rlim) == -1)
1102+
#endif /* RLIMIT_NOFILE */
10991103
{
1100-
#endif /* HAVE_RLIMIT_NOFILE */
11011104
fprintf(stderr, "getrlimit failed. reason: %s\n", strerror(errno));
11021105
exit(1);
11031106
}
@@ -1107,8 +1110,7 @@ main(int argc, char **argv)
11071110
fprintf(stderr, "Use limit/ulimt to increase the limit before using pgbench.\n");
11081111
exit(1);
11091112
}
1110-
#endif /* #if !(defined(__CYGWIN__) ||
1111-
* defined(__MINGW32__)) */
1113+
#endif /* #if !(defined(__CYGWIN__) || defined(__MINGW32__)) */
11121114
break;
11131115
case 'C':
11141116
is_connect = 1;

0 commit comments

Comments
 (0)