Skip to content

Commit

Permalink
Change functions to static prototypes to avoid polluting global names…
Browse files Browse the repository at this point in the history
…pace.
  • Loading branch information
Rik Wehbring committed Oct 15, 2010
1 parent aa00a38 commit d225ed5
Show file tree
Hide file tree
Showing 23 changed files with 99 additions and 101 deletions.
4 changes: 2 additions & 2 deletions address.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: address.c,v 1.63 2010/10/13 03:18:58 rikster5 Exp $ */
/* $Id: address.c,v 1.64 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* address.c
Expand Down Expand Up @@ -514,7 +514,7 @@ int pc_address_write(struct Address *addr, PCRecType rt, unsigned char attrib,
}

#ifdef JPILOT_DEBUG
void print_address_list(AddressList **al)
static void print_address_list(AddressList **al)
{
AddressList *temp_al, *prev_al;

Expand Down
4 changes: 2 additions & 2 deletions dat.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: dat.c,v 1.24 2010/03/29 05:44:28 rikster5 Exp $ */
/* $Id: dat.c,v 1.25 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* dat.c
Expand Down Expand Up @@ -391,7 +391,7 @@ static int print_date(int palm_date)
#endif

#ifdef JPILOT_DEBUG
int print_field(struct field *f)
static int print_field(struct field *f)
{

switch (f->type) {
Expand Down
19 changes: 14 additions & 5 deletions datebook.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: datebook.c,v 1.70 2010/10/13 03:18:58 rikster5 Exp $ */
/* $Id: datebook.c,v 1.71 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* datebook.c
Expand Down Expand Up @@ -146,11 +146,15 @@ int datebook_add_exception(struct CalendarEvent *cale, int year, int mon, int da
return EXIT_SUCCESS;
}


/* All datebook appts are handled as calendar events now.
* This code scrap is being kept for reference only. */
#if 0
/*
* If a copy is made, then it should be freed through free_Appointment
*/
int datebook_copy_appointment(struct Appointment *a1,
struct Appointment **a2)
static int datebook_copy_appointment(struct Appointment *a1,
struct Appointment **a2)
{
long datebook_version;

Expand Down Expand Up @@ -179,6 +183,7 @@ int datebook_copy_appointment(struct Appointment *a1,

return EXIT_SUCCESS;
}
#endif

/*
* If a copy is made, then it should be freed through free_CalendarEvent
Expand All @@ -197,8 +202,11 @@ int copy_calendar_event(const struct CalendarEvent *source,
return EXIT_FAILURE;
}

int datebook_sort(AppointmentList **al,
int (*compare_func)(const void*, const void*))
/* calendar_sort in calendar.c is now used for all datebook sorting
* This code scrap is being kept for reference only. */
#if 0
static int datebook_sort(AppointmentList **al,
int (*compare_func)(const void*, const void*))
{
AppointmentList *temp_al;
AppointmentList **sort_al;
Expand Down Expand Up @@ -239,6 +247,7 @@ int datebook_sort(AppointmentList **al,

return EXIT_SUCCESS;
}
#endif

#ifdef ENABLE_DATEBK
static void db3_fill_struct(char *note, int type, struct db4_struct *db4)
Expand Down
8 changes: 1 addition & 7 deletions datebook.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: datebook.h,v 1.29 2010/10/07 21:04:31 rikster5 Exp $ */
/* $Id: datebook.h,v 1.30 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* datebook.h
Expand Down Expand Up @@ -103,19 +103,13 @@ int weed_datebook_list(AppointmentList **al, int mon, int year,
int weed_calendar_event_list(CalendarEventList **cel, int mon, int year,
int skip_privates, int *mask);

/* Sorts a list of appointments according to the comparison function given */
int datebook_sort(AppointmentList **al,
int (*compare_func)(const void*, const void*));

/* Year is years since 1900 */
/* Mon is 0-11 */
/* Day is 1-31 */
/* */
int datebook_add_exception(struct CalendarEvent *cale, int year, int mon, int day);
int get_calendar_or_datebook_app_info(struct CalendarAppInfo *cai, long datebook_version);

int datebook_copy_appointment(struct Appointment *a1,
struct Appointment **a2);
int copy_calendar_event(const struct CalendarEvent *source,
struct CalendarEvent **dest);
/* returns a bit mask where bit 1 is day one, etc. Bit is set if an */
Expand Down
4 changes: 2 additions & 2 deletions datebook_gui.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: datebook_gui.c,v 1.235 2010/10/15 14:26:03 rikster5 Exp $ */
/* $Id: datebook_gui.c,v 1.236 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* datebook_gui.c
Expand Down Expand Up @@ -1792,7 +1792,7 @@ static int dialog_current_all_cancel(void)
}

#ifdef EASTER
int dialog_easter(int mday)
static int dialog_easter(int mday)
{
char text[255];
char who[50];
Expand Down
24 changes: 12 additions & 12 deletions dialer/jpilot-dial.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: jpilot-dial.c,v 1.5 2010/10/13 03:19:00 rikster5 Exp $ */
/* $Id: jpilot-dial.c,v 1.6 2010/10/15 16:42:14 rikster5 Exp $ */

/*******************************************************************************
* jpilot-dial.c
Expand Down Expand Up @@ -48,10 +48,10 @@

#define DEV_MIXER "/dev/mixer"

void gen_costab(void);
void dial_digit(int c);
void silent(int msec);
void dial(int f1, int f2, int msec);
static void gen_costab(void);
static void dial_digit(int c);
static void silent(int msec);
static void dial(int f1, int f2, int msec);

char *output = "/dev/dsp";
int bits = 8;
Expand Down Expand Up @@ -81,7 +81,7 @@ int left = 0;

int fd;

void Usage(void) {
static void Usage(void) {
fprintf(stderr, "usage: jpilot-dial [options] number ...\n"
" Valid options with their default values are:\n"
" Duration options:\n"
Expand All @@ -105,7 +105,7 @@ void Usage(void) {
exit(1);
}

void
static void
initialize_audiodev(void) {
int speed_local = speed;
int channels = 1;
Expand Down Expand Up @@ -147,7 +147,7 @@ initialize_audiodev(void) {
speed = speed_local;
}

void
static void
getvalue(int *arg, int *index, int argc,
char **argv, int min, int max) {

Expand Down Expand Up @@ -363,7 +363,7 @@ int main(int argc, char **argv)
exit(0);
}

void
static void
dial_digit(int c) {
DEBUG(fprintf(stderr, "dial_digit %#c\n", c));
switch(c) {
Expand Down Expand Up @@ -418,7 +418,7 @@ dial_digit(int c) {
}
}

void
static void
silent(int msec) {
int time;
if (msec <= 0)
Expand Down Expand Up @@ -452,7 +452,7 @@ silent(int msec) {
dialed = 0;
}

void
static void
dial(int f1, int f2, int msec) {
int i1, i2, d1, d2, e1, e2, g1, g2;
int time;
Expand Down Expand Up @@ -532,7 +532,7 @@ dial(int f1, int f2, int msec) {
dialed = 1;
}

void
static void
gen_costab(void) {
int i;
double d;
Expand Down
8 changes: 4 additions & 4 deletions font.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#ifdef FONT_TEST

void SetFontRecursively2(GtkWidget *widget, gpointer data)
static void SetFontRecursively2(GtkWidget *widget, gpointer data)
{
GtkStyle *style;
char *font_desc;
Expand All @@ -20,7 +20,7 @@ void SetFontRecursively2(GtkWidget *widget, gpointer data)
gtk_container_foreach(GTK_CONTAINER(widget), SetFontRecursively2, font_desc);
}
}
void font_selection_ok(GtkWidget *w, GtkFontSelectionDialog *fs)
static void font_selection_ok(GtkWidget *w, GtkFontSelectionDialog *fs)
{
gchar *s = gtk_font_selection_dialog_get_font_name(fs);

Expand All @@ -32,7 +32,7 @@ void font_selection_ok(GtkWidget *w, GtkFontSelectionDialog *fs)
cb_app_button(NULL, GINT_TO_POINTER(REDRAW));
}

void font_sel_dialog()
static void font_sel_dialog()
{
static GtkWidget *fontsel = NULL;

Expand Down Expand Up @@ -61,7 +61,7 @@ void font_sel_dialog()
}
}

void cb_font(GtkWidget *widget, gpointer data)
static void cb_font(GtkWidget *widget, gpointer data)
{
font_sel_dialog();

Expand Down
7 changes: 5 additions & 2 deletions log.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: log.c,v 1.34 2010/10/13 03:18:58 rikster5 Exp $ */
/* $Id: log.c,v 1.35 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* log.c
Expand Down Expand Up @@ -57,6 +57,9 @@ int glob_log_gui_mask;
extern void output_to_pane(const char *str);
extern pid_t jpilot_master_pid;

/****************************** Prototypes ************************************/
static int jp_vlogf (int level, const char *format, va_list val);

/****************************** Main Code *************************************/
int jp_logf(int level, const char *format, ...)
{
Expand All @@ -75,7 +78,7 @@ int jp_logf(int level, const char *format, ...)
return rval;
}

int jp_vlogf (int level, const char *format, va_list val) {
static int jp_vlogf (int level, const char *format, va_list val) {
char real_buf[WRITE_MAX_BUF+32];
char *buf, *local_buf;
int size;
Expand Down
3 changes: 1 addition & 2 deletions log.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: log.h,v 1.14 2010/03/29 05:44:29 rikster5 Exp $ */
/* $Id: log.h,v 1.15 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* log.h
Expand Down Expand Up @@ -48,7 +48,6 @@ extern int glob_log_stdout_mask;
extern int glob_log_gui_mask;

int jp_logf(int log_level, const char *format, ...);
int jp_vlogf (int level, const char *format, va_list val);
int write_to_parent(int command, const char *format, ...);

#endif
6 changes: 3 additions & 3 deletions memo.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: memo.c,v 1.51 2010/10/13 03:18:58 rikster5 Exp $ */
/* $Id: memo.c,v 1.52 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* memo.c
Expand Down Expand Up @@ -40,7 +40,7 @@
/********************************* Constants **********************************/

/****************************** Prototypes ************************************/
int memo_sort(MemoList **memol, int sort_order);
static int memo_sort(MemoList **memol, int sort_order);

/****************************** Main Code *************************************/
void free_MemoList(MemoList **memo)
Expand Down Expand Up @@ -262,7 +262,7 @@ static int memo_compare(const void *v1, const void *v2)
return strcoll(str2, str1);
}

int memo_sort(MemoList **memol, int sort_order)
static int memo_sort(MemoList **memol, int sort_order)
{
/* struct MemoAppInfo memo_ai; */
MemoList *temp_memol;
Expand Down
10 changes: 5 additions & 5 deletions memo_gui.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: memo_gui.c,v 1.142 2010/10/13 03:18:58 rikster5 Exp $ */
/* $Id: memo_gui.c,v 1.143 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* memo_gui.c
Expand Down Expand Up @@ -90,10 +90,10 @@ static MemoList *export_memo_list=NULL;

/****************************** Prototypes ************************************/
static int memo_clear_details(void);
int memo_clist_redraw(void);
static int memo_clist_redraw(void);
static void connect_changed_signals(int con_or_dis);
static int memo_find(void);
int memo_get_details(struct Memo *new_memo, unsigned char *attrib);
static int memo_get_details(struct Memo *new_memo, unsigned char *attrib);
static void memo_update_clist(GtkWidget *clist, GtkWidget *tooltip_widget,
MemoList **memo_list, int category, int main);
static void cb_add_new_record(GtkWidget *widget, gpointer data);
Expand Down Expand Up @@ -935,7 +935,7 @@ static int memo_clear_details(void)
return EXIT_SUCCESS;
}

int memo_get_details(struct Memo *new_memo, unsigned char *attrib)
static int memo_get_details(struct Memo *new_memo, unsigned char *attrib)
{
int i;
GtkTextIter start_iter;
Expand Down Expand Up @@ -1369,7 +1369,7 @@ static int memo_find(void)
return EXIT_SUCCESS;
}

int memo_clist_redraw(void)
static int memo_clist_redraw(void)
{
memo_update_clist(clist, category_menu1, &glob_memo_list, memo_category, TRUE);

Expand Down
10 changes: 5 additions & 5 deletions monthview_gui.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: monthview_gui.c,v 1.56 2010/10/13 03:18:58 rikster5 Exp $ */
/* $Id: monthview_gui.c,v 1.57 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* monthview_gui.c
Expand Down Expand Up @@ -54,8 +54,8 @@ static int glob_offset;
static struct tm glob_month_date;

/****************************** Prototypes ************************************/
int display_months_appts(struct tm *glob_month_date, GtkWidget **glob_month_texts);
void hide_show_month_boxes(void);
static int display_months_appts(struct tm *glob_month_date, GtkWidget **glob_month_texts);
static void hide_show_month_boxes(void);

/****************************** Main Code *************************************/
static gboolean cb_destroy(GtkWidget *widget)
Expand Down Expand Up @@ -156,7 +156,7 @@ static void cb_enter_selected_day(GtkWidget *widget,
* Also, set a global offset for indexing day 1.
* Also relabel day labels.
*/
void hide_show_month_boxes(void)
static void hide_show_month_boxes(void)
{
int n;
int dow, ndim;
Expand Down Expand Up @@ -281,7 +281,7 @@ static void create_month_boxes_texts(GtkWidget *month_vbox)
gtk_box_pack_start(GTK_BOX(month_vbox), text, TRUE, TRUE, 4);
}

int display_months_appts(struct tm *date_in, GtkWidget **day_texts)
static int display_months_appts(struct tm *date_in, GtkWidget **day_texts)
{
CalendarEventList *ce_list;
CalendarEventList *temp_cel;
Expand Down
5 changes: 2 additions & 3 deletions otherconv.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: otherconv.c,v 1.45 2010/10/13 03:18:59 rikster5 Exp $ */
/* $Id: otherconv.c,v 1.46 2010/10/15 16:42:13 rikster5 Exp $ */

/*******************************************************************************
* otherconv.c
Expand Down Expand Up @@ -64,8 +64,7 @@ static GIConv glob_frompda = NULL;
* To avoid conflicting declarations, it is reimplemented as a thin
* inline function over the library function strlen
*/
size_t oc_strnlen(const char *s, size_t maxlen);
inline size_t oc_strnlen(const char *s, size_t maxlen)
static inline size_t oc_strnlen(const char *s, size_t maxlen)
{
return min(strlen(s), maxlen);
}
Expand Down
Loading

0 comments on commit d225ed5

Please sign in to comment.