g2: clean up compile/link errors

Many missing "extern" declarations, it's hard to imagine why the
related compile/link errors just showed up.

Type: fix

Change-Id: I0878bf5fdb10ffdd8e0c49c9e5153cddaf3bc1fd
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/tools/g2/clib.c b/src/tools/g2/clib.c
index 845026b..da9fd52 100644
--- a/src/tools/g2/clib.c
+++ b/src/tools/g2/clib.c
@@ -1,4 +1,4 @@
-/* 
+/*
  *------------------------------------------------------------------
  * Copyright (c) 2009-2016 Cisco and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -35,19 +35,19 @@
 #include "cpel.h"
 #include "g2.h"
 
-int widest_track_format;
+extern int widest_track_format;
 
 typedef struct bound_track_ {
     u32 track;
     u8  *track_str;
 } bound_track_t;
 
-bound_track_t *bound_tracks;
+extern bound_track_t *bound_tracks;
 
-uword *the_evtdef_hash; /* (event-id, event-definition) hash */
-uword *the_trackdef_hash; /* (track-id, track-definition) hash */
+extern uword *the_evtdef_hash; /* (event-id, event-definition) hash */
+extern uword *the_trackdef_hash; /* (track-id, track-definition) hash */
 
-elog_main_t elog_main;
+extern elog_main_t elog_main;
 
 void *get_clib_event (unsigned int datum)
 {
diff --git a/src/tools/g2/g2.h b/src/tools/g2/g2.h
index f1f268a..3bd9697 100644
--- a/src/tools/g2/g2.h
+++ b/src/tools/g2/g2.h
@@ -1,4 +1,4 @@
-/* 
+/*
  *------------------------------------------------------------------
  * Copyright (c) 2005-2016 Cisco and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,9 +29,9 @@
  * main.c
  */
 
-GtkWidget *g_mainwindow;
-GtkWidget *g_mainvbox;
-GtkWidget *g_mainhbox;
+extern GtkWidget *g_mainwindow;
+extern GtkWidget *g_mainvbox;
+extern GtkWidget *g_mainhbox;
 
 /*
  * pointsel.c
@@ -55,30 +55,30 @@
     char pad[2];
 } event_def_t;
 
-event_def_t *find_event_definition (ulong code);
+extern event_def_t *find_event_definition (ulong code);
 
-event_def_t g_eventdefs[NEVENTS];
+extern event_def_t g_eventdefs[NEVENTS];
 
 /*
  * config params
  */
-int c_maxpointsel;        /* max # points shown in selector dlg */
-gint c_view1_draw_width;
-gint c_view1_draw_height;
+extern int c_maxpointsel;        /* max # points shown in selector dlg */
+extern gint c_view1_draw_width;
+extern gint c_view1_draw_height;
 
 /*
  * menu1.c
  */
 
 void menu1_init(void);
-void modal_dialog (char *label_text, char *retry_text, char *default_value, 
+void modal_dialog (char *label_text, char *retry_text, char *default_value,
                    boolean (*cb)(char *));
 void infobox(char *label_text, char *text);
 /*
  * view1.c
  */
-GdkFont *g_font;
-GdkColor fg_black, bg_white;
+extern GdkFont *g_font;
+extern GdkColor fg_black, bg_white;
 void view1_init(void);
 void view1_display(void);
 void view1_read_events_callback(void);
@@ -132,10 +132,10 @@
 int read_clib_file(char *file);
 void cpel_event_init(ulong);
 void add_event_from_cpel_file(ulong, char * , char *);
-void add_event_from_clib_file(unsigned int event, char *name, 
+void add_event_from_clib_file(unsigned int event, char *name,
                               unsigned int vec_index);
 void add_cpel_event(ulonglong delta, ulong, ulong, ulong);
-void add_clib_event(double delta, unsigned short track, 
+void add_clib_event(double delta, unsigned short track,
                     unsigned short event, unsigned int index);
 void cpel_event_finalize(void);
 void *get_clib_event (unsigned int datum);
@@ -145,7 +145,7 @@
     ulong pid_value;            /* The actual pid value */
     ulong pid_index;            /* Index in pid sort order */
 } pid_data_t;
-    
+
 #define EVENT_FLAG_SELECT 	0x00000001 /* This event is selected */
 #define EVENT_FLAG_SEARCHRSLT   0x00000002 /* This event is the search rslt */
 #define EVENT_FLAG_CLIB         0x00000004 /* clib event */
@@ -169,28 +169,28 @@
 } event_t;
 
 
-boolean g_little_endian;
-event_t *g_events;
-ulong g_nevents;
-pid_sort_t *g_pids;
-pid_sort_t *g_original_pids;
-int g_npids;
-pid_data_t *g_pid_data_list;
+extern boolean g_little_endian;
+extern event_t *g_events;
+extern ulong g_nevents;
+extern pid_sort_t *g_pids;
+extern pid_sort_t *g_original_pids;
+extern int g_npids;
+extern pid_data_t *g_pid_data_list;
 
 #define PIDHASH_NBUCKETS	20021 /* Should be prime */
 
-boolean ticks_per_ns_set;
-double ticks_per_ns;
+extern boolean ticks_per_ns_set;
+extern double ticks_per_ns;
 
 /*
  * version.c
  */
-const char *version_string;
-const char *minor_v_string;
+extern const char *version_string;
+extern const char *minor_v_string;
 
 /*
  * cpel.c
  */
 char *get_track_label(unsigned long);
-int widest_track_format;
+extern int widest_track_format;
 char *strtab_ref(unsigned long);
diff --git a/src/tools/g2/view1.c b/src/tools/g2/view1.c
index ca05b78..a0cff90 100644
--- a/src/tools/g2/view1.c
+++ b/src/tools/g2/view1.c
@@ -1630,8 +1630,6 @@
     event_t *ep;
     pid_data_t *pid;
     int i;
-    int index;
-    int pid_index;
     f64 fdata;
 
     /* Gather summary statistics... */