mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Mark many more function (and some objects) static
I noticed commit db3b531e2cab765a00475054d2e9046c9d0437d3 in the history where Simon added a bunch of "static" qualifiers. That suggested that consistently marking internal functions "static" is desirable, so I tried a build using GCC's -Wmissing-declarations, which requires prior declaration (presumed to be in a header file) of all global functions. This commit makes the GTK build clean under GCC's -Wmissing-declarations. I've also adding "static" to a few obviously internal objects, but GCC doesn't complain about those so I certainly haven't got them all.
This commit is contained in:
106
gtk.c
106
gtk.c
@ -319,7 +319,7 @@ void frontend_default_colour(frontend *fe, float *output)
|
||||
output[0] = output[1] = output[2] = 0.9F;
|
||||
}
|
||||
|
||||
void gtk_status_bar(void *handle, const char *text)
|
||||
static void gtk_status_bar(void *handle, const char *text)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
|
||||
@ -1154,7 +1154,7 @@ static void align_and_draw_text(int index, int align, int x, int y,
|
||||
* The exported drawing functions.
|
||||
*/
|
||||
|
||||
void gtk_start_draw(void *handle)
|
||||
static void gtk_start_draw(void *handle)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
fe->bbox_l = fe->w;
|
||||
@ -1164,20 +1164,21 @@ void gtk_start_draw(void *handle)
|
||||
setup_drawing(fe);
|
||||
}
|
||||
|
||||
void gtk_clip(void *handle, int x, int y, int w, int h)
|
||||
static void gtk_clip(void *handle, int x, int y, int w, int h)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
do_clip(fe, x, y, w, h);
|
||||
}
|
||||
|
||||
void gtk_unclip(void *handle)
|
||||
static void gtk_unclip(void *handle)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
do_unclip(fe);
|
||||
}
|
||||
|
||||
void gtk_draw_text(void *handle, int x, int y, int fonttype, int fontsize,
|
||||
int align, int colour, const char *text)
|
||||
static void gtk_draw_text(void *handle, int x, int y, int fonttype,
|
||||
int fontsize, int align, int colour,
|
||||
const char *text)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
int i;
|
||||
@ -1209,43 +1210,45 @@ void gtk_draw_text(void *handle, int x, int y, int fonttype, int fontsize,
|
||||
align_and_draw_text(fe, i, align, x, y, text);
|
||||
}
|
||||
|
||||
void gtk_draw_rect(void *handle, int x, int y, int w, int h, int colour)
|
||||
static void gtk_draw_rect(void *handle, int x, int y, int w, int h, int colour)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
fe->dr_api->set_colour(fe, colour);
|
||||
do_draw_rect(fe, x, y, w, h);
|
||||
}
|
||||
|
||||
void gtk_draw_line(void *handle, int x1, int y1, int x2, int y2, int colour)
|
||||
static void gtk_draw_line(void *handle, int x1, int y1, int x2, int y2,
|
||||
int colour)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
fe->dr_api->set_colour(fe, colour);
|
||||
do_draw_line(fe, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void gtk_draw_thick_line(void *handle, float thickness,
|
||||
float x1, float y1, float x2, float y2, int colour)
|
||||
static void gtk_draw_thick_line(void *handle, float thickness,
|
||||
float x1, float y1, float x2, float y2,
|
||||
int colour)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
fe->dr_api->set_colour(fe, colour);
|
||||
do_draw_thick_line(fe, thickness, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void gtk_draw_poly(void *handle, const int *coords, int npoints,
|
||||
int fillcolour, int outlinecolour)
|
||||
static void gtk_draw_poly(void *handle, const int *coords, int npoints,
|
||||
int fillcolour, int outlinecolour)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
do_draw_poly(fe, coords, npoints, fillcolour, outlinecolour);
|
||||
}
|
||||
|
||||
void gtk_draw_circle(void *handle, int cx, int cy, int radius,
|
||||
int fillcolour, int outlinecolour)
|
||||
static void gtk_draw_circle(void *handle, int cx, int cy, int radius,
|
||||
int fillcolour, int outlinecolour)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
do_draw_circle(fe, cx, cy, radius, fillcolour, outlinecolour);
|
||||
}
|
||||
|
||||
blitter *gtk_blitter_new(void *handle, int w, int h)
|
||||
static blitter *gtk_blitter_new(void *handle, int w, int h)
|
||||
{
|
||||
blitter *bl = snew(blitter);
|
||||
setup_blitter(bl, w, h);
|
||||
@ -1254,13 +1257,13 @@ blitter *gtk_blitter_new(void *handle, int w, int h)
|
||||
return bl;
|
||||
}
|
||||
|
||||
void gtk_blitter_free(void *handle, blitter *bl)
|
||||
static void gtk_blitter_free(void *handle, blitter *bl)
|
||||
{
|
||||
teardown_blitter(bl);
|
||||
sfree(bl);
|
||||
}
|
||||
|
||||
void gtk_blitter_save(void *handle, blitter *bl, int x, int y)
|
||||
static void gtk_blitter_save(void *handle, blitter *bl, int x, int y)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
do_blitter_save(fe, bl, x, y);
|
||||
@ -1268,7 +1271,7 @@ void gtk_blitter_save(void *handle, blitter *bl, int x, int y)
|
||||
bl->y = y;
|
||||
}
|
||||
|
||||
void gtk_blitter_load(void *handle, blitter *bl, int x, int y)
|
||||
static void gtk_blitter_load(void *handle, blitter *bl, int x, int y)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
if (x == BLITTER_FROMSAVED && y == BLITTER_FROMSAVED) {
|
||||
@ -1278,7 +1281,7 @@ void gtk_blitter_load(void *handle, blitter *bl, int x, int y)
|
||||
do_blitter_load(fe, bl, x, y);
|
||||
}
|
||||
|
||||
void gtk_draw_update(void *handle, int x, int y, int w, int h)
|
||||
static void gtk_draw_update(void *handle, int x, int y, int w, int h)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
if (fe->bbox_l > x ) fe->bbox_l = x ;
|
||||
@ -1287,7 +1290,7 @@ void gtk_draw_update(void *handle, int x, int y, int w, int h)
|
||||
if (fe->bbox_d < y+h) fe->bbox_d = y+h;
|
||||
}
|
||||
|
||||
void gtk_end_draw(void *handle)
|
||||
static void gtk_end_draw(void *handle)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
|
||||
@ -1311,7 +1314,8 @@ void gtk_end_draw(void *handle)
|
||||
}
|
||||
|
||||
#ifdef USE_PANGO
|
||||
char *gtk_text_fallback(void *handle, const char *const *strings, int nstrings)
|
||||
static char *gtk_text_fallback(void *handle, const char *const *strings,
|
||||
int nstrings)
|
||||
{
|
||||
/*
|
||||
* We assume Pango can cope with any UTF-8 likely to be emitted
|
||||
@ -1322,18 +1326,18 @@ char *gtk_text_fallback(void *handle, const char *const *strings, int nstrings)
|
||||
#endif
|
||||
|
||||
#ifdef USE_PRINTING
|
||||
void gtk_begin_doc(void *handle, int pages)
|
||||
static void gtk_begin_doc(void *handle, int pages)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
gtk_print_operation_set_n_pages(fe->printop, pages);
|
||||
}
|
||||
|
||||
void gtk_begin_page(void *handle, int number)
|
||||
static void gtk_begin_page(void *handle, int number)
|
||||
{
|
||||
}
|
||||
|
||||
void gtk_begin_puzzle(void *handle, float xm, float xc,
|
||||
float ym, float yc, int pw, int ph, float wmm)
|
||||
static void gtk_begin_puzzle(void *handle, float xm, float xc,
|
||||
float ym, float yc, int pw, int ph, float wmm)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
double ppw, pph, pox, poy, dpmmx, dpmmy;
|
||||
@ -1371,27 +1375,27 @@ void gtk_begin_puzzle(void *handle, float xm, float xc,
|
||||
fe->hatchspace = 1.0 * pw / wmm;
|
||||
}
|
||||
|
||||
void gtk_end_puzzle(void *handle)
|
||||
static void gtk_end_puzzle(void *handle)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
cairo_restore(fe->cr);
|
||||
}
|
||||
|
||||
void gtk_end_page(void *handle, int number)
|
||||
static void gtk_end_page(void *handle, int number)
|
||||
{
|
||||
}
|
||||
|
||||
void gtk_end_doc(void *handle)
|
||||
static void gtk_end_doc(void *handle)
|
||||
{
|
||||
}
|
||||
|
||||
void gtk_line_width(void *handle, float width)
|
||||
static void gtk_line_width(void *handle, float width)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
cairo_set_line_width(fe->cr, width);
|
||||
}
|
||||
|
||||
void gtk_line_dotted(void *handle, bool dotted)
|
||||
static void gtk_line_dotted(void *handle, bool dotted)
|
||||
{
|
||||
frontend *fe = (frontend *)handle;
|
||||
|
||||
@ -1404,7 +1408,7 @@ void gtk_line_dotted(void *handle, bool dotted)
|
||||
}
|
||||
#endif /* USE_PRINTING */
|
||||
|
||||
const struct internal_drawing_api internal_drawing = {
|
||||
static const struct internal_drawing_api internal_drawing = {
|
||||
draw_set_colour,
|
||||
#ifdef USE_CAIRO
|
||||
do_draw_fill,
|
||||
@ -1413,14 +1417,14 @@ const struct internal_drawing_api internal_drawing = {
|
||||
};
|
||||
|
||||
#ifdef USE_CAIRO
|
||||
const struct internal_drawing_api internal_printing = {
|
||||
static const struct internal_drawing_api internal_printing = {
|
||||
print_set_colour,
|
||||
do_print_fill,
|
||||
do_print_fill_preserve,
|
||||
};
|
||||
#endif
|
||||
|
||||
const struct drawing_api gtk_drawing = {
|
||||
static const struct drawing_api gtk_drawing = {
|
||||
gtk_draw_text,
|
||||
gtk_draw_rect,
|
||||
gtk_draw_line,
|
||||
@ -1798,8 +1802,8 @@ static void align_label(GtkLabel *label, double x, double y)
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
bool message_box(GtkWidget *parent, const char *title, const char *msg,
|
||||
bool centre, int type)
|
||||
static bool message_box(GtkWidget *parent, const char *title, const char *msg,
|
||||
bool centre, int type)
|
||||
{
|
||||
GtkWidget *window;
|
||||
gint ret;
|
||||
@ -1893,7 +1897,7 @@ bool message_box(GtkWidget *parent, const char *title, const char *msg,
|
||||
}
|
||||
#endif /* GTK_CHECK_VERSION(3,0,0) */
|
||||
|
||||
void error_box(GtkWidget *parent, const char *msg)
|
||||
static void error_box(GtkWidget *parent, const char *msg)
|
||||
{
|
||||
message_box(parent, "Error", msg, false, MB_OK);
|
||||
}
|
||||
@ -2414,7 +2418,7 @@ static void set_selection(frontend *fe, GdkAtom selection)
|
||||
}
|
||||
}
|
||||
|
||||
void write_clip(frontend *fe, char *data)
|
||||
static void write_clip(frontend *fe, char *data)
|
||||
{
|
||||
if (fe->paste_data)
|
||||
sfree(fe->paste_data);
|
||||
@ -2426,16 +2430,16 @@ void write_clip(frontend *fe, char *data)
|
||||
set_selection(fe, GDK_SELECTION_CLIPBOARD);
|
||||
}
|
||||
|
||||
void selection_get(GtkWidget *widget, GtkSelectionData *seldata,
|
||||
guint info, guint time_stamp, gpointer data)
|
||||
static void selection_get(GtkWidget *widget, GtkSelectionData *seldata,
|
||||
guint info, guint time_stamp, gpointer data)
|
||||
{
|
||||
frontend *fe = (frontend *)data;
|
||||
gtk_selection_data_set(seldata, gtk_selection_data_get_target(seldata), 8,
|
||||
fe->paste_data, fe->paste_data_len);
|
||||
}
|
||||
|
||||
gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
|
||||
gpointer data)
|
||||
static gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
|
||||
gpointer data)
|
||||
{
|
||||
frontend *fe = (frontend *)data;
|
||||
|
||||
@ -2533,7 +2537,7 @@ static char *file_selector(frontend *fe, const char *title, bool save)
|
||||
#endif
|
||||
|
||||
#ifdef USE_PRINTING
|
||||
GObject *create_print_widget(GtkPrintOperation *print, gpointer data)
|
||||
static GObject *create_print_widget(GtkPrintOperation *print, gpointer data)
|
||||
{
|
||||
GtkLabel *count_label, *width_label, *height_label,
|
||||
*scale_llabel, *scale_rlabel;
|
||||
@ -2674,8 +2678,8 @@ GObject *create_print_widget(GtkPrintOperation *print, gpointer data)
|
||||
return G_OBJECT(grid);
|
||||
}
|
||||
|
||||
void apply_print_widget(GtkPrintOperation *print,
|
||||
GtkWidget *widget, gpointer data)
|
||||
static void apply_print_widget(GtkPrintOperation *print,
|
||||
GtkWidget *widget, gpointer data)
|
||||
{
|
||||
frontend *fe = (frontend *)data;
|
||||
|
||||
@ -2698,8 +2702,8 @@ void apply_print_widget(GtkPrintOperation *print,
|
||||
}
|
||||
}
|
||||
|
||||
void print_begin(GtkPrintOperation *printop,
|
||||
GtkPrintContext *context, gpointer data)
|
||||
static void print_begin(GtkPrintOperation *printop,
|
||||
GtkPrintContext *context, gpointer data)
|
||||
{
|
||||
frontend *fe = (frontend *)data;
|
||||
midend *nme = NULL; /* non-interactive midend for bulk puzzle generation */
|
||||
@ -2750,16 +2754,16 @@ void print_begin(GtkPrintOperation *printop,
|
||||
document_begin(fe->doc, fe->print_dr);
|
||||
}
|
||||
|
||||
void draw_page(GtkPrintOperation *printop,
|
||||
GtkPrintContext *context,
|
||||
gint page_nr, gpointer data)
|
||||
static void draw_page(GtkPrintOperation *printop,
|
||||
GtkPrintContext *context,
|
||||
gint page_nr, gpointer data)
|
||||
{
|
||||
frontend *fe = (frontend *)data;
|
||||
document_print_page(fe->doc, fe->print_dr, page_nr);
|
||||
}
|
||||
|
||||
void print_end(GtkPrintOperation *printop,
|
||||
GtkPrintContext *context, gpointer data)
|
||||
static void print_end(GtkPrintOperation *printop,
|
||||
GtkPrintContext *context, gpointer data)
|
||||
{
|
||||
frontend *fe = (frontend *)data;
|
||||
|
||||
|
Reference in New Issue
Block a user