1
1
/*
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 $
3
3
*
4
4
* pgbench: a simple benchmark program for PostgreSQL
5
5
* written by Tatsuo Ishii
@@ -868,15 +868,15 @@ process_file(char *filename)
868
868
}
869
869
870
870
alloc_num = COMMANDS_ALLOC_NUM ;
871
- my_commands = (Command * * ) malloc (sizeof (Command * * ) * alloc_num );
871
+ my_commands = (Command * * ) malloc (sizeof (Command * ) * alloc_num );
872
872
if (my_commands == NULL )
873
873
return false;
874
874
875
875
if (strcmp (filename , "-" ) == 0 )
876
876
fd = stdin ;
877
877
else if ((fd = fopen (filename , "r" )) == NULL )
878
878
{
879
- fprintf (stderr , "%s: %s\n" , strerror (errno ), filename );
879
+ fprintf (stderr , "%s: %s\n" , filename , strerror (errno ));
880
880
return false;
881
881
}
882
882
@@ -899,7 +899,7 @@ process_file(char *filename)
899
899
if (lineno >= alloc_num )
900
900
{
901
901
alloc_num += COMMANDS_ALLOC_NUM ;
902
- my_commands = realloc (my_commands , alloc_num );
902
+ my_commands = realloc (my_commands , sizeof ( Command * ) * alloc_num );
903
903
if (my_commands == NULL )
904
904
{
905
905
fclose (fd );
@@ -930,7 +930,7 @@ process_builtin(char *tb)
930
930
return NULL ;
931
931
932
932
alloc_num = COMMANDS_ALLOC_NUM ;
933
- my_commands = malloc (sizeof (Command * * ) * alloc_num );
933
+ my_commands = ( Command * * ) malloc (sizeof (Command * ) * alloc_num );
934
934
if (my_commands == NULL )
935
935
return NULL ;
936
936
@@ -965,7 +965,7 @@ process_builtin(char *tb)
965
965
if (lineno >= alloc_num )
966
966
{
967
967
alloc_num += COMMANDS_ALLOC_NUM ;
968
- my_commands = realloc (my_commands , alloc_num );
968
+ my_commands = realloc (my_commands , sizeof ( Command * ) * alloc_num );
969
969
if (my_commands == NULL )
970
970
{
971
971
return NULL ;
@@ -1031,7 +1031,7 @@ main(int argc, char **argv)
1031
1031
* 2: skip update of branches and tellers */
1032
1032
char * filename = NULL ;
1033
1033
1034
- static CState * state ; /* status of clients */
1034
+ CState * state ; /* status of clients */
1035
1035
1036
1036
struct timeval tv1 ; /* start up time */
1037
1037
struct timeval tv2 ; /* after establishing all connections to the
@@ -1101,7 +1101,7 @@ main(int argc, char **argv)
1101
1101
if (getrlimit (RLIMIT_OFILE , & rlim ) == -1 )
1102
1102
#endif /* RLIMIT_NOFILE */
1103
1103
{
1104
- fprintf (stderr , "getrlimit failed. reason : %s\n" , strerror (errno ));
1104
+ fprintf (stderr , "getrlimit failed: %s\n" , strerror (errno ));
1105
1105
exit (1 );
1106
1106
}
1107
1107
if (rlim .rlim_cur <= (nclients + 2 ))
@@ -1173,7 +1173,7 @@ main(int argc, char **argv)
1173
1173
1174
1174
remains = nclients ;
1175
1175
1176
- state = (CState * ) malloc (sizeof (* state ) * nclients );
1176
+ state = (CState * ) malloc (sizeof (CState ) * nclients );
1177
1177
if (state == NULL )
1178
1178
{
1179
1179
fprintf (stderr , "Couldn't allocate memory for state\n" );
0 commit comments