From 6a53b447e5726bc7d7b8405b1b1dd958c701b007 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 29 Jun 2019 16:09:45 -0700 Subject: Declare global variables as extern in headers Otherwise, each source file that includes the header will create a new definition, which are usually merged together by the linker. Multiple definitions of an object is not allowed in ISO C. --- frontends/amiga/search.h | 2 +- frontends/atari/bitmap.h | 2 +- frontends/atari/encoding.h | 2 +- frontends/atari/file.h | 2 +- frontends/atari/font.h | 2 +- frontends/atari/search.h | 2 +- frontends/framebuffer/fetch.h | 2 +- frontends/gtk/download.h | 2 +- frontends/gtk/fetch.h | 2 +- frontends/gtk/search.h | 2 +- frontends/gtk/selection.h | 2 +- frontends/monkey/fetch.h | 2 +- frontends/riscos/bitmap.h | 2 +- frontends/riscos/font.h | 2 +- frontends/riscos/gui.h | 2 +- frontends/riscos/textselection.h | 2 +- frontends/riscos/ucstables.h | 2 +- frontends/windows/bitmap.h | 2 +- frontends/windows/clipboard.h | 2 +- frontends/windows/fetch.h | 2 +- frontends/windows/file.h | 2 +- frontends/windows/font.h | 4 ++-- 22 files changed, 23 insertions(+), 23 deletions(-) (limited to 'frontends') diff --git a/frontends/amiga/search.h b/frontends/amiga/search.h index f30352cd5..1815ef954 100755 --- a/frontends/amiga/search.h +++ b/frontends/amiga/search.h @@ -22,7 +22,7 @@ struct gui_search_table; struct gui_window; -struct gui_search_table *amiga_search_table; +extern struct gui_search_table *amiga_search_table; /** * Change the displayed search status. diff --git a/frontends/atari/bitmap.h b/frontends/atari/bitmap.h index b0fa18069..72bad555e 100644 --- a/frontends/atari/bitmap.h +++ b/frontends/atari/bitmap.h @@ -54,7 +54,7 @@ */ #define MFDB_SIZE( bpp, stride, h ) ( ((stride >> 3) * h) * bpp ) -struct gui_bitmap_table *atari_bitmap_table; +extern struct gui_bitmap_table *atari_bitmap_table; struct bitmap { int width; diff --git a/frontends/atari/encoding.h b/frontends/atari/encoding.h index 784aa8273..53db7b78b 100644 --- a/frontends/atari/encoding.h +++ b/frontends/atari/encoding.h @@ -25,7 +25,7 @@ #include "utils/utf8.h" -struct gui_utf8_table *atari_utf8_table; +extern struct gui_utf8_table *atari_utf8_table; nserror utf8_to_local_encoding(const char *string, size_t len, char **result); nserror utf8_from_local_encoding(const char *string, size_t len, char **result); diff --git a/frontends/atari/file.h b/frontends/atari/file.h index b368567c7..3e568834b 100644 --- a/frontends/atari/file.h +++ b/frontends/atari/file.h @@ -21,7 +21,7 @@ #include "utils/file.h" -struct gui_file_table *atari_file_table; +extern struct gui_file_table *atari_file_table; #endif /* FILE_C_INCLUDED */ diff --git a/frontends/atari/font.h b/frontends/atari/font.h index a01d000c0..c0eb99dcd 100644 --- a/frontends/atari/font.h +++ b/frontends/atari/font.h @@ -19,7 +19,7 @@ #ifndef NS_ATARI_FONT_H #define NS_ATARI_FONT_H -struct gui_layout_table *atari_layout_table; +extern struct gui_layout_table *atari_layout_table; #endif /* NETSURF_FB_FONT_H */ diff --git a/frontends/atari/search.h b/frontends/atari/search.h index 04dfed4eb..adac62652 100644 --- a/frontends/atari/search.h +++ b/frontends/atari/search.h @@ -43,7 +43,7 @@ typedef struct s_search_form_session * SEARCH_FORM_SESSION; struct s_search_form_session * nsatari_search_session_create(OBJECT * obj, struct gui_window *gw); -struct gui_search_table *atari_search_table; +extern struct gui_search_table *atari_search_table; void nsatari_search_session_destroy(struct s_search_form_session *s); void nsatari_search_perform(struct s_search_form_session *s, OBJECT *obj, diff --git a/frontends/framebuffer/fetch.h b/frontends/framebuffer/fetch.h index 718b08300..d00f3aa21 100644 --- a/frontends/framebuffer/fetch.h +++ b/frontends/framebuffer/fetch.h @@ -20,6 +20,6 @@ #ifndef NETSURF_FB_FETCH_H #define NETSURF_FB_FETCH_H -struct gui_fetch_table *framebuffer_fetch_table; +extern struct gui_fetch_table *framebuffer_fetch_table; #endif diff --git a/frontends/gtk/download.h b/frontends/gtk/download.h index 0b1097655..b720650ca 100644 --- a/frontends/gtk/download.h +++ b/frontends/gtk/download.h @@ -24,7 +24,7 @@ /** * download operation table for gtk */ -struct gui_download_table *nsgtk_download_table; +extern struct gui_download_table *nsgtk_download_table; /** * Initialise download window ready for use. diff --git a/frontends/gtk/fetch.h b/frontends/gtk/fetch.h index a095adbf9..9175ccdf2 100644 --- a/frontends/gtk/fetch.h +++ b/frontends/gtk/fetch.h @@ -19,7 +19,7 @@ #ifndef NETSURF_GTK_FETCH_H #define NETSURF_GTK_FETCH_H -struct gui_fetch_table *nsgtk_fetch_table; +extern struct gui_fetch_table *nsgtk_fetch_table; void gtk_fetch_filetype_init(const char *mimefile); void gtk_fetch_filetype_fin(void); diff --git a/frontends/gtk/search.h b/frontends/gtk/search.h index dd8c60d0f..b2162b805 100644 --- a/frontends/gtk/search.h +++ b/frontends/gtk/search.h @@ -19,7 +19,7 @@ #ifndef _NETSURF_GTK_SEARCH_H_ #define _NETSURF_GTK_SEARCH_H_ -struct gui_search_table *nsgtk_search_table; +extern struct gui_search_table *nsgtk_search_table; struct nsgtk_scaffolding; diff --git a/frontends/gtk/selection.h b/frontends/gtk/selection.h index 6463692cf..07716a0d9 100644 --- a/frontends/gtk/selection.h +++ b/frontends/gtk/selection.h @@ -19,6 +19,6 @@ #ifndef GTK_SELECTION_H #define GTK_SELECTION_H -struct gui_clipboard_table *nsgtk_clipboard_table; +extern struct gui_clipboard_table *nsgtk_clipboard_table; #endif diff --git a/frontends/monkey/fetch.h b/frontends/monkey/fetch.h index f146e2ef8..2881e92c5 100644 --- a/frontends/monkey/fetch.h +++ b/frontends/monkey/fetch.h @@ -19,6 +19,6 @@ #ifndef NS_MONKEY_FETCH_H #define NS_MONKEY_FETCH_H -struct gui_fetch_table *monkey_fetch_table; +extern struct gui_fetch_table *monkey_fetch_table; #endif /* NS_MONKEY_FETCH_H */ diff --git a/frontends/riscos/bitmap.h b/frontends/riscos/bitmap.h index 3aca30de6..f66ebb317 100644 --- a/frontends/riscos/bitmap.h +++ b/frontends/riscos/bitmap.h @@ -25,7 +25,7 @@ struct hlcache_handle; struct bitmap; /** bitmap operations table */ -struct gui_bitmap_table *riscos_bitmap_table; +extern struct gui_bitmap_table *riscos_bitmap_table; /** save with full alpha channel (if not opaque) */ #define BITMAP_SAVE_FULL_ALPHA (1 << 0) diff --git a/frontends/riscos/font.h b/frontends/riscos/font.h index a29bad83a..5a82f63ee 100644 --- a/frontends/riscos/font.h +++ b/frontends/riscos/font.h @@ -26,7 +26,7 @@ #include struct plot_font_style; -struct gui_layout_table *riscos_layout_table; +extern struct gui_layout_table *riscos_layout_table; /** desktop font, size and style being used */ extern char ro_gui_desktop_font_family[]; diff --git a/frontends/riscos/gui.h b/frontends/riscos/gui.h index 65c85f92a..d4ff9ce62 100644 --- a/frontends/riscos/gui.h +++ b/frontends/riscos/gui.h @@ -167,7 +167,7 @@ nserror riscos_schedule(int t, void (*callback)(void *p), void *p); /* in search.c */ void ro_gui_search_init(void); void ro_gui_search_prepare(struct browser_window *g); -struct gui_search_table *riscos_search_table; +extern struct gui_search_table *riscos_search_table; /* in print.c */ void ro_gui_print_init(void); diff --git a/frontends/riscos/textselection.h b/frontends/riscos/textselection.h index 400e3dd26..0d7cc169b 100644 --- a/frontends/riscos/textselection.h +++ b/frontends/riscos/textselection.h @@ -25,7 +25,7 @@ #include "oslib/wimp.h" -struct gui_clipboard_table *riscos_clipboard_table; +extern struct gui_clipboard_table *riscos_clipboard_table; void gui_start_selection(struct gui_window *g); diff --git a/frontends/riscos/ucstables.h b/frontends/riscos/ucstables.h index e5d838249..31db5d882 100644 --- a/frontends/riscos/ucstables.h +++ b/frontends/riscos/ucstables.h @@ -21,7 +21,7 @@ * This is only used if nothing claims Service_International,8 */ -struct gui_utf8_table *riscos_utf8_table; +extern struct gui_utf8_table *riscos_utf8_table; nserror utf8_to_local_encoding(const char *string, size_t len, char **result); nserror utf8_from_local_encoding(const char *string, size_t len, char **result); diff --git a/frontends/windows/bitmap.h b/frontends/windows/bitmap.h index c723159e1..c57061d77 100644 --- a/frontends/windows/bitmap.h +++ b/frontends/windows/bitmap.h @@ -20,7 +20,7 @@ #ifndef _NETSURF_WINDOWS_BITMAP_H_ #define _NETSURF_WINDOWS_BITMAP_H_ -struct gui_bitmap_table *win32_bitmap_table; +extern struct gui_bitmap_table *win32_bitmap_table; struct bitmap { HBITMAP windib; diff --git a/frontends/windows/clipboard.h b/frontends/windows/clipboard.h index c707c2437..92f096b8e 100644 --- a/frontends/windows/clipboard.h +++ b/frontends/windows/clipboard.h @@ -22,6 +22,6 @@ /** * The clipboard operation function table for win32 */ -struct gui_clipboard_table *win32_clipboard_table; +extern struct gui_clipboard_table *win32_clipboard_table; #endif diff --git a/frontends/windows/fetch.h b/frontends/windows/fetch.h index 20984f14a..e85402ac3 100644 --- a/frontends/windows/fetch.h +++ b/frontends/windows/fetch.h @@ -22,7 +22,7 @@ /** * win32 API fetch operation table */ -struct gui_fetch_table *win32_fetch_table; +extern struct gui_fetch_table *win32_fetch_table; /** * Translate resource to win32 resource data. diff --git a/frontends/windows/file.h b/frontends/windows/file.h index 5262dde2c..19dfba3b1 100644 --- a/frontends/windows/file.h +++ b/frontends/windows/file.h @@ -24,6 +24,6 @@ #ifndef _NETSURF_WINDOWS_FILE_H_ #define _NETSURF_WINDOWS_FILE_H_ -struct gui_file_table *win32_file_table; +extern struct gui_file_table *win32_file_table; #endif diff --git a/frontends/windows/font.h b/frontends/windows/font.h index ec2c262ff..8219e4c76 100644 --- a/frontends/windows/font.h +++ b/frontends/windows/font.h @@ -35,8 +35,8 @@ struct font_desc { const char *encoding; }; -struct gui_layout_table *win32_layout_table; -struct gui_utf8_table *win32_utf8_table; +extern struct gui_layout_table *win32_layout_table; +extern struct gui_utf8_table *win32_utf8_table; /** * convert from utf-8 to win32 font encoding. -- cgit v1.2.3