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.
This commit is contained in:
Michael Forney 2019-06-29 16:09:45 -07:00 committed by Vincent Sanders
parent 1c3ce67c62
commit 6a53b447e5
23 changed files with 24 additions and 24 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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 */

View File

@ -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,

View File

@ -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

View File

@ -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.

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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 */

View File

@ -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)

View File

@ -26,7 +26,7 @@
#include <rufl.h>
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[];

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -117,7 +117,7 @@ struct gui_file_table {
};
/** Default (posix) file operation table. */
struct gui_file_table *default_file_table;
extern struct gui_file_table *default_file_table;
/**
* Generate a path from one or more component elemnts.