9
9
FILE * LOGOUTPUT ;
10
10
char logbuffer [4096 ];
11
11
12
- void
12
+ static void
13
13
log_entry (const char * logentry )
14
14
{
15
15
time_t curtime ;
@@ -22,10 +22,14 @@ log_entry(const char *logentry)
22
22
fprintf (LOGOUTPUT , "[%s] %s\n" , timebuffer , logentry );
23
23
}
24
24
25
- /* Function used to detatch the pg_autovacuum daemon from the tty and go into the background *
26
- * This code is mostly ripped directly from pm_dameonize in postmaster.c *
27
- * with unneeded code removed. */
28
- void
25
+ /*
26
+ * Function used to detach the pg_autovacuum daemon from the tty and go into
27
+ * the background.
28
+ *
29
+ * This code is mostly ripped directly from pm_dameonize in postmaster.c with
30
+ * unneeded code removed.
31
+ */
32
+ static void
29
33
daemonize ()
30
34
{
31
35
pid_t pid ;
@@ -57,7 +61,7 @@ daemonize()
57
61
}
58
62
59
63
/* Create and return tbl_info struct with initialized to values from row or res */
60
- tbl_info *
64
+ static tbl_info *
61
65
init_table_info (PGresult * res , int row , db_info * dbi )
62
66
{
63
67
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
142
139
143
/* Set thresholds = base_value + scaling_factor * reltuples
140
144
Should be called after a vacuum since vacuum updates values in pg_class */
141
- void
145
+ static void
142
146
update_table_thresholds (db_info * dbi , tbl_info * tbl , int vacuum_type )
143
147
{
144
148
PGresult * res = NULL ;
@@ -196,7 +200,7 @@ update_table_thresholds(db_info * dbi, tbl_info * tbl, int vacuum_type)
196
200
db_disconnect (dbi );
197
201
}
198
202
199
- void
203
+ static void
200
204
update_table_list (db_info * dbi )
201
205
{
202
206
int disconnect = 0 ;
@@ -296,7 +300,7 @@ update_table_list(db_info * dbi)
296
300
}
297
301
298
302
/* Free memory, and remove the node from the list */
299
- void
303
+ static void
300
304
remove_table_from_list (Dlelem * tbl_to_remove )
301
305
{
302
306
tbl_info * tbl = ((tbl_info * ) DLE_VAL (tbl_to_remove ));
@@ -328,7 +332,7 @@ remove_table_from_list(Dlelem *tbl_to_remove)
328
332
}
329
333
330
334
/* Free the entire table list */
331
- void
335
+ static void
332
336
free_tbl_list (Dllist * tbl_list )
333
337
{
334
338
Dlelem * tbl_elem = DLGetHead (tbl_list );
@@ -343,7 +347,7 @@ free_tbl_list(Dllist *tbl_list)
343
347
DLFreeList (tbl_list );
344
348
}
345
349
346
- void
350
+ static void
347
351
print_table_list (Dllist * table_list )
348
352
{
349
353
Dlelem * table_elem = DLGetHead (table_list );
@@ -355,7 +359,7 @@ print_table_list(Dllist *table_list)
355
359
}
356
360
}
357
361
358
- void
362
+ static void
359
363
print_table_info (tbl_info * tbl )
360
364
{
361
365
sprintf (logbuffer , " table name: %s.%s" , tbl -> dbi -> dbname , tbl -> table_name );
@@ -381,7 +385,7 @@ print_table_info(tbl_info * tbl)
381
385
/* Beginning of DB Management Functions */
382
386
383
387
/* init_db_list() creates the db_list and initalizes template1 */
384
- Dllist *
388
+ static Dllist *
385
389
init_db_list ()
386
390
{
387
391
Dllist * db_list = DLNewList ();
@@ -419,7 +423,7 @@ init_db_list()
419
423
420
424
/* Simple function to create an instance of the dbinfo struct
421
425
Initalizes all the pointers and connects to the database */
422
- db_info *
426
+ static db_info *
423
427
init_dbinfo (char * dbname , Oid oid , long age )
424
428
{
425
429
db_info * newdbinfo = (db_info * ) malloc (sizeof (db_info ));
@@ -452,7 +456,7 @@ init_dbinfo(char *dbname, Oid oid, long age)
452
456
}
453
457
454
458
/* Function adds and removes databases from the db_list as appropriate */
455
- void
459
+ static void
456
460
update_db_list (Dllist * db_list )
457
461
{
458
462
int disconnect = 0 ;
@@ -580,7 +584,7 @@ So we do a full database vacuum if age > 1.5billion
580
584
return 0 if nothing happened,
581
585
return 1 if the database needed a database wide vacuum
582
586
*/
583
- int
587
+ static int
584
588
xid_wraparound_check (db_info * dbi )
585
589
{
586
590
/*
@@ -602,7 +606,7 @@ xid_wraparound_check(db_info * dbi)
602
606
}
603
607
604
608
/* Close DB connection, free memory, and remove the node from the list */
605
- void
609
+ static void
606
610
remove_db_from_list (Dlelem * db_to_remove )
607
611
{
608
612
db_info * dbi = ((db_info * ) DLE_VAL (db_to_remove ));
@@ -646,7 +650,7 @@ remove_db_from_list(Dlelem *db_to_remove)
646
650
647
651
/* Function is called before program exit to free all memory
648
652
mostly it's just to keep valgrind happy */
649
- void
653
+ static void
650
654
free_db_list (Dllist * db_list )
651
655
{
652
656
Dlelem * db_elem = DLGetHead (db_list );
@@ -662,7 +666,7 @@ free_db_list(Dllist *db_list)
662
666
DLFreeList (db_list );
663
667
}
664
668
665
- void
669
+ static void
666
670
print_db_list (Dllist * db_list , int print_table_lists )
667
671
{
668
672
Dlelem * db_elem = DLGetHead (db_list );
@@ -674,7 +678,7 @@ print_db_list(Dllist *db_list, int print_table_lists)
674
678
}
675
679
}
676
680
677
- void
681
+ static void
678
682
print_db_info (db_info * dbi , int print_tbl_list )
679
683
{
680
684
sprintf (logbuffer , "dbname: %s" , (dbi -> dbname ) ? dbi -> dbname : "(null)" );
@@ -710,7 +714,7 @@ print_db_info(db_info * dbi, int print_tbl_list)
710
714
/* Beginning of misc Functions */
711
715
712
716
/* Perhaps add some test to this function to make sure that the stats we need are available */
713
- PGconn *
717
+ static PGconn *
714
718
db_connect (db_info * dbi )
715
719
{
716
720
PGconn * db_conn =
@@ -729,7 +733,7 @@ db_connect(db_info * dbi)
729
733
return db_conn ;
730
734
} /* end of db_connect() */
731
735
732
- void
736
+ static void
733
737
db_disconnect (db_info * dbi )
734
738
{
735
739
if (dbi -> conn != NULL )
@@ -739,7 +743,7 @@ db_disconnect(db_info * dbi)
739
743
}
740
744
}
741
745
742
- int
746
+ static int
743
747
check_stats_enabled (db_info * dbi )
744
748
{
745
749
PGresult * res ;
@@ -754,7 +758,7 @@ check_stats_enabled(db_info * dbi)
754
758
return ret ;
755
759
}
756
760
757
- PGresult *
761
+ static PGresult *
758
762
send_query (const char * query , db_info * dbi )
759
763
{
760
764
PGresult * res ;
@@ -795,7 +799,7 @@ send_query(const char *query, db_info * dbi)
795
799
} /* End of send_query() */
796
800
797
801
798
- void
802
+ static void
799
803
free_cmd_args ()
800
804
{
801
805
if (args != NULL )
@@ -808,7 +812,7 @@ free_cmd_args()
808
812
}
809
813
}
810
814
811
- cmd_args *
815
+ static cmd_args *
812
816
get_cmd_args (int argc , char * argv [])
813
817
{
814
818
int c ;
@@ -902,7 +906,7 @@ get_cmd_args(int argc, char *argv[])
902
906
return args ;
903
907
}
904
908
905
- void
909
+ static void
906
910
usage ()
907
911
{
908
912
int i = 0 ;
@@ -937,7 +941,7 @@ usage()
937
941
fprintf (stderr , " [-h] help (Show this output)\n" );
938
942
}
939
943
940
- void
944
+ static void
941
945
print_cmd_args ()
942
946
{
943
947
sprintf (logbuffer , "Printing command_args" );
0 commit comments