11/*
2- * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.44 2005/10/15 20:24:00 tgl Exp $
2+ * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.45 2005/10/29 19:38:07 tgl Exp $
33 *
44 * pgbench: a simple benchmark program for PostgreSQL
55 * written by Tatsuo Ishii
@@ -868,15 +868,15 @@ process_file(char *filename)
868868}
869869
870870alloc_num = COMMANDS_ALLOC_NUM ;
871- my_commands = (Command * * )malloc (sizeof (Command * * )* alloc_num );
871+ my_commands = (Command * * )malloc (sizeof (Command * )* alloc_num );
872872if (my_commands == NULL )
873873return false;
874874
875875if (strcmp (filename ,"-" )== 0 )
876876fd = stdin ;
877877else if ((fd = fopen (filename ,"r" ))== NULL )
878878{
879- fprintf (stderr ,"%s: %s\n" ,strerror (errno ), filename );
879+ fprintf (stderr ,"%s: %s\n" ,filename , strerror (errno ));
880880return false;
881881}
882882
@@ -899,7 +899,7 @@ process_file(char *filename)
899899if (lineno >=alloc_num )
900900{
901901alloc_num += COMMANDS_ALLOC_NUM ;
902- my_commands = realloc (my_commands ,alloc_num );
902+ my_commands = realloc (my_commands ,sizeof ( Command * ) * alloc_num );
903903if (my_commands == NULL )
904904{
905905fclose (fd );
@@ -930,7 +930,7 @@ process_builtin(char *tb)
930930return NULL ;
931931
932932alloc_num = COMMANDS_ALLOC_NUM ;
933- my_commands = malloc (sizeof (Command * * )* alloc_num );
933+ my_commands = ( Command * * ) malloc (sizeof (Command * )* alloc_num );
934934if (my_commands == NULL )
935935return NULL ;
936936
@@ -965,7 +965,7 @@ process_builtin(char *tb)
965965if (lineno >=alloc_num )
966966{
967967alloc_num += COMMANDS_ALLOC_NUM ;
968- my_commands = realloc (my_commands ,alloc_num );
968+ my_commands = realloc (my_commands ,sizeof ( Command * ) * alloc_num );
969969if (my_commands == NULL )
970970{
971971return NULL ;
@@ -1031,7 +1031,7 @@ main(int argc, char **argv)
10311031 * 2: skip update of branches and tellers */
10321032char * filename = NULL ;
10331033
1034- static CState * state ;/* status of clients */
1034+ CState * state ;/* status of clients */
10351035
10361036struct timeval tv1 ;/* start up time */
10371037struct timeval tv2 ;/* after establishing all connections to the
@@ -1101,7 +1101,7 @@ main(int argc, char **argv)
11011101if (getrlimit (RLIMIT_OFILE ,& rlim )== -1 )
11021102#endif /* RLIMIT_NOFILE */
11031103{
1104- fprintf (stderr ,"getrlimit failed. reason : %s\n" ,strerror (errno ));
1104+ fprintf (stderr ,"getrlimit failed: %s\n" ,strerror (errno ));
11051105exit (1 );
11061106}
11071107if (rlim .rlim_cur <= (nclients + 2 ))
@@ -1173,7 +1173,7 @@ main(int argc, char **argv)
11731173
11741174remains = nclients ;
11751175
1176- state = (CState * )malloc (sizeof (* state )* nclients );
1176+ state = (CState * )malloc (sizeof (CState )* nclients );
11771177if (state == NULL )
11781178{
11791179fprintf (stderr ,"Couldn't allocate memory for state\n" );