Commit 51d1a12e authored by Tom Lane's avatar Tom Lane

Fix portability issues with functions that don't match their declaration.

parent b3fcc816
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
FILE *LOGOUTPUT; FILE *LOGOUTPUT;
char logbuffer[4096]; char logbuffer[4096];
void static void
log_entry(const char *logentry) log_entry(const char *logentry)
{ {
time_t curtime; time_t curtime;
...@@ -22,10 +22,14 @@ log_entry(const char *logentry) ...@@ -22,10 +22,14 @@ log_entry(const char *logentry)
fprintf(LOGOUTPUT, "[%s] %s\n", timebuffer, logentry); fprintf(LOGOUTPUT, "[%s] %s\n", timebuffer, logentry);
} }
/* Function used to detatch the pg_autovacuum daemon from the tty and go into the background * /*
* This code is mostly ripped directly from pm_dameonize in postmaster.c * * Function used to detach the pg_autovacuum daemon from the tty and go into
* with unneeded code removed. */ * the background.
void *
* This code is mostly ripped directly from pm_dameonize in postmaster.c with
* unneeded code removed.
*/
static void
daemonize() daemonize()
{ {
pid_t pid; pid_t pid;
...@@ -57,7 +61,7 @@ daemonize() ...@@ -57,7 +61,7 @@ daemonize()
} }
/* Create and return tbl_info struct with initialized to values from row or res */ /* Create and return tbl_info struct with initialized to values from row or res */
tbl_info * static tbl_info *
init_table_info(PGresult *res, int row, db_info * dbi) init_table_info(PGresult *res, int row, db_info * dbi)
{ {
tbl_info *new_tbl = (tbl_info *) malloc(sizeof(tbl_info)); tbl_info *new_tbl = (tbl_info *) malloc(sizeof(tbl_info));
...@@ -138,7 +142,7 @@ init_table_info(PGresult *res, int row, db_info * dbi) ...@@ -138,7 +142,7 @@ init_table_info(PGresult *res, int row, db_info * dbi)
/* Set thresholds = base_value + scaling_factor * reltuples /* Set thresholds = base_value + scaling_factor * reltuples
Should be called after a vacuum since vacuum updates values in pg_class */ Should be called after a vacuum since vacuum updates values in pg_class */
void static void
update_table_thresholds(db_info * dbi, tbl_info * tbl, int vacuum_type) update_table_thresholds(db_info * dbi, tbl_info * tbl, int vacuum_type)
{ {
PGresult *res = NULL; PGresult *res = NULL;
...@@ -196,7 +200,7 @@ update_table_thresholds(db_info * dbi, tbl_info * tbl, int vacuum_type) ...@@ -196,7 +200,7 @@ update_table_thresholds(db_info * dbi, tbl_info * tbl, int vacuum_type)
db_disconnect(dbi); db_disconnect(dbi);
} }
void static void
update_table_list(db_info * dbi) update_table_list(db_info * dbi)
{ {
int disconnect = 0; int disconnect = 0;
...@@ -296,7 +300,7 @@ update_table_list(db_info * dbi) ...@@ -296,7 +300,7 @@ update_table_list(db_info * dbi)
} }
/* Free memory, and remove the node from the list */ /* Free memory, and remove the node from the list */
void static void
remove_table_from_list(Dlelem *tbl_to_remove) remove_table_from_list(Dlelem *tbl_to_remove)
{ {
tbl_info *tbl = ((tbl_info *) DLE_VAL(tbl_to_remove)); tbl_info *tbl = ((tbl_info *) DLE_VAL(tbl_to_remove));
...@@ -328,7 +332,7 @@ remove_table_from_list(Dlelem *tbl_to_remove) ...@@ -328,7 +332,7 @@ remove_table_from_list(Dlelem *tbl_to_remove)
} }
/* Free the entire table list */ /* Free the entire table list */
void static void
free_tbl_list(Dllist *tbl_list) free_tbl_list(Dllist *tbl_list)
{ {
Dlelem *tbl_elem = DLGetHead(tbl_list); Dlelem *tbl_elem = DLGetHead(tbl_list);
...@@ -343,7 +347,7 @@ free_tbl_list(Dllist *tbl_list) ...@@ -343,7 +347,7 @@ free_tbl_list(Dllist *tbl_list)
DLFreeList(tbl_list); DLFreeList(tbl_list);
} }
void static void
print_table_list(Dllist *table_list) print_table_list(Dllist *table_list)
{ {
Dlelem *table_elem = DLGetHead(table_list); Dlelem *table_elem = DLGetHead(table_list);
...@@ -355,7 +359,7 @@ print_table_list(Dllist *table_list) ...@@ -355,7 +359,7 @@ print_table_list(Dllist *table_list)
} }
} }
void static void
print_table_info(tbl_info * tbl) print_table_info(tbl_info * tbl)
{ {
sprintf(logbuffer, " table name: %s.%s", tbl->dbi->dbname, tbl->table_name); sprintf(logbuffer, " table name: %s.%s", tbl->dbi->dbname, tbl->table_name);
...@@ -381,7 +385,7 @@ print_table_info(tbl_info * tbl) ...@@ -381,7 +385,7 @@ print_table_info(tbl_info * tbl)
/* Beginning of DB Management Functions */ /* Beginning of DB Management Functions */
/* init_db_list() creates the db_list and initalizes template1 */ /* init_db_list() creates the db_list and initalizes template1 */
Dllist * static Dllist *
init_db_list() init_db_list()
{ {
Dllist *db_list = DLNewList(); Dllist *db_list = DLNewList();
...@@ -419,7 +423,7 @@ init_db_list() ...@@ -419,7 +423,7 @@ init_db_list()
/* Simple function to create an instance of the dbinfo struct /* Simple function to create an instance of the dbinfo struct
Initalizes all the pointers and connects to the database */ Initalizes all the pointers and connects to the database */
db_info * static db_info *
init_dbinfo(char *dbname, Oid oid, long age) init_dbinfo(char *dbname, Oid oid, long age)
{ {
db_info *newdbinfo = (db_info *) malloc(sizeof(db_info)); db_info *newdbinfo = (db_info *) malloc(sizeof(db_info));
...@@ -452,7 +456,7 @@ init_dbinfo(char *dbname, Oid oid, long age) ...@@ -452,7 +456,7 @@ init_dbinfo(char *dbname, Oid oid, long age)
} }
/* Function adds and removes databases from the db_list as appropriate */ /* Function adds and removes databases from the db_list as appropriate */
void static void
update_db_list(Dllist *db_list) update_db_list(Dllist *db_list)
{ {
int disconnect = 0; int disconnect = 0;
...@@ -580,7 +584,7 @@ So we do a full database vacuum if age > 1.5billion ...@@ -580,7 +584,7 @@ So we do a full database vacuum if age > 1.5billion
return 0 if nothing happened, return 0 if nothing happened,
return 1 if the database needed a database wide vacuum return 1 if the database needed a database wide vacuum
*/ */
int static int
xid_wraparound_check(db_info * dbi) xid_wraparound_check(db_info * dbi)
{ {
/* /*
...@@ -602,7 +606,7 @@ xid_wraparound_check(db_info * dbi) ...@@ -602,7 +606,7 @@ xid_wraparound_check(db_info * dbi)
} }
/* Close DB connection, free memory, and remove the node from the list */ /* Close DB connection, free memory, and remove the node from the list */
void static void
remove_db_from_list(Dlelem *db_to_remove) remove_db_from_list(Dlelem *db_to_remove)
{ {
db_info *dbi = ((db_info *) DLE_VAL(db_to_remove)); db_info *dbi = ((db_info *) DLE_VAL(db_to_remove));
...@@ -646,7 +650,7 @@ remove_db_from_list(Dlelem *db_to_remove) ...@@ -646,7 +650,7 @@ remove_db_from_list(Dlelem *db_to_remove)
/* Function is called before program exit to free all memory /* Function is called before program exit to free all memory
mostly it's just to keep valgrind happy */ mostly it's just to keep valgrind happy */
void static void
free_db_list(Dllist *db_list) free_db_list(Dllist *db_list)
{ {
Dlelem *db_elem = DLGetHead(db_list); Dlelem *db_elem = DLGetHead(db_list);
...@@ -662,7 +666,7 @@ free_db_list(Dllist *db_list) ...@@ -662,7 +666,7 @@ free_db_list(Dllist *db_list)
DLFreeList(db_list); DLFreeList(db_list);
} }
void static void
print_db_list(Dllist *db_list, int print_table_lists) print_db_list(Dllist *db_list, int print_table_lists)
{ {
Dlelem *db_elem = DLGetHead(db_list); Dlelem *db_elem = DLGetHead(db_list);
...@@ -674,7 +678,7 @@ print_db_list(Dllist *db_list, int print_table_lists) ...@@ -674,7 +678,7 @@ print_db_list(Dllist *db_list, int print_table_lists)
} }
} }
void static void
print_db_info(db_info * dbi, int print_tbl_list) print_db_info(db_info * dbi, int print_tbl_list)
{ {
sprintf(logbuffer, "dbname: %s", (dbi->dbname) ? dbi->dbname : "(null)"); sprintf(logbuffer, "dbname: %s", (dbi->dbname) ? dbi->dbname : "(null)");
...@@ -710,7 +714,7 @@ print_db_info(db_info * dbi, int print_tbl_list) ...@@ -710,7 +714,7 @@ print_db_info(db_info * dbi, int print_tbl_list)
/* Beginning of misc Functions */ /* Beginning of misc Functions */
/* Perhaps add some test to this function to make sure that the stats we need are available */ /* Perhaps add some test to this function to make sure that the stats we need are available */
PGconn * static PGconn *
db_connect(db_info * dbi) db_connect(db_info * dbi)
{ {
PGconn *db_conn = PGconn *db_conn =
...@@ -729,7 +733,7 @@ db_connect(db_info * dbi) ...@@ -729,7 +733,7 @@ db_connect(db_info * dbi)
return db_conn; return db_conn;
} /* end of db_connect() */ } /* end of db_connect() */
void static void
db_disconnect(db_info * dbi) db_disconnect(db_info * dbi)
{ {
if (dbi->conn != NULL) if (dbi->conn != NULL)
...@@ -739,7 +743,7 @@ db_disconnect(db_info * dbi) ...@@ -739,7 +743,7 @@ db_disconnect(db_info * dbi)
} }
} }
int static int
check_stats_enabled(db_info * dbi) check_stats_enabled(db_info * dbi)
{ {
PGresult *res; PGresult *res;
...@@ -754,7 +758,7 @@ check_stats_enabled(db_info * dbi) ...@@ -754,7 +758,7 @@ check_stats_enabled(db_info * dbi)
return ret; return ret;
} }
PGresult * static PGresult *
send_query(const char *query, db_info * dbi) send_query(const char *query, db_info * dbi)
{ {
PGresult *res; PGresult *res;
...@@ -795,7 +799,7 @@ send_query(const char *query, db_info * dbi) ...@@ -795,7 +799,7 @@ send_query(const char *query, db_info * dbi)
} /* End of send_query() */ } /* End of send_query() */
void static void
free_cmd_args() free_cmd_args()
{ {
if (args != NULL) if (args != NULL)
...@@ -808,7 +812,7 @@ free_cmd_args() ...@@ -808,7 +812,7 @@ free_cmd_args()
} }
} }
cmd_args * static cmd_args *
get_cmd_args(int argc, char *argv[]) get_cmd_args(int argc, char *argv[])
{ {
int c; int c;
...@@ -902,7 +906,7 @@ get_cmd_args(int argc, char *argv[]) ...@@ -902,7 +906,7 @@ get_cmd_args(int argc, char *argv[])
return args; return args;
} }
void static void
usage() usage()
{ {
int i = 0; int i = 0;
...@@ -937,7 +941,7 @@ usage() ...@@ -937,7 +941,7 @@ usage()
fprintf(stderr, " [-h] help (Show this output)\n"); fprintf(stderr, " [-h] help (Show this output)\n");
} }
void static void
print_cmd_args() print_cmd_args()
{ {
sprintf(logbuffer, "Printing command_args"); sprintf(logbuffer, "Printing command_args");
......
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