Prefer static to extern where either will do

* src/charset.c (charset_table_size):
* src/pdumper.c (dump_private):
* src/sysdep.c (init_sigsegv):
* src/window.c (old_selected_window):
Now static.
* src/charset.c (charset_table_size):
Now int, since the value always fits in int.
* src/gtkutil.c (xg_gtk_initialized): Now present only if
HAVE_XWIDGETS, to make it clearer that this is an xwidgets
hack.  All uses changed.
* src/lread.c (ndefsubr): Remove; unused.
* src/pdumper.h: Use usual GNU indenting style for functions,
since my static-vs-extern checking hack relies on it.
(dump_public): Always declare; simpler and doesn’t hurt.
(pdumper_handle_page_fault): Remove unused decl.
This commit is contained in:
Paul Eggert 2019-01-31 15:31:41 -08:00
parent 05d2fc7170
commit 47679e6323
10 changed files with 18 additions and 36 deletions

View file

@ -62,7 +62,7 @@ Lisp_Object Vcharset_hash_table;
/* Table of struct charset. */
struct charset *charset_table;
ptrdiff_t charset_table_size;
static int charset_table_size;
int charset_table_used;
/* Special charsets corresponding to symbols. */

View file

@ -248,7 +248,6 @@ extern Lisp_Object Vcharset_hash_table;
/* Table of struct charset. */
extern struct charset *charset_table;
extern ptrdiff_t charset_table_size;
extern int charset_table_used;
#define CHARSET_FROM_ID(id) (charset_table + (id))

View file

@ -147,7 +147,9 @@ struct xg_frame_tb_info
GtkTextDirection dir;
};
#ifdef HAVE_XWIDGETS
bool xg_gtk_initialized; /* Used to make sure xwidget calls are possible */
#endif
static GtkWidget * xg_get_widget_from_map (ptrdiff_t idx);
@ -5324,7 +5326,9 @@ xg_initialize (void)
x_last_font_name = NULL;
#endif
#ifdef HAVE_XWIDGETS
xg_gtk_initialized = true;
#endif
}
#endif /* USE_GTK */

View file

@ -4402,8 +4402,6 @@ init_obarray_once (void)
}
int ndefsubr;
void
defsubr (union Aligned_Lisp_Subr *aname)
{
@ -4413,7 +4411,6 @@ defsubr (union Aligned_Lisp_Subr *aname)
XSETPVECTYPE (sname, PVEC_SUBR);
XSETSUBR (tem, sname);
set_symbol_function (sym, tem);
++ndefsubr;
}
#ifdef NOTDEF /* Use fset in subr.el now! */

View file

@ -5019,7 +5019,7 @@ struct pdumper_loaded_dump_private
};
struct pdumper_loaded_dump dump_public;
struct pdumper_loaded_dump_private dump_private;
static struct pdumper_loaded_dump_private dump_private;
/* Return a pointer to offset OFFSET within the dump, which begins at
DUMP_BASE. DUMP_BASE must be equal to the current dump load

View file

@ -52,8 +52,7 @@ INLINE_HEADER_BEGIN
extern void pdumper_remember_scalar_impl (void *data, ptrdiff_t nbytes);
INLINE
void
INLINE void
pdumper_remember_scalar (void *data, ptrdiff_t nbytes)
{
#ifdef HAVE_PDUMPER
@ -70,8 +69,7 @@ extern void pdumper_remember_lv_ptr_raw_impl (
/* Remember the pointer at *PTR. *PTR must be null or point to a Lisp
object. TYPE is the rough type of Lisp object to which *PTR
points. */
INLINE
void
INLINE void
pdumper_remember_lv_ptr_raw (void* ptr, enum Lisp_Type type)
{
#ifdef HAVE_PDUMPER
@ -137,15 +135,12 @@ struct pdumper_loaded_dump {
uintptr_t end;
};
#ifdef HAVE_PDUMPER
extern struct pdumper_loaded_dump dump_public;
#endif
/* Return whether the OBJ points somewhere into the loaded dump image.
Works even when we have no dump loaded --- in this case, it just
returns false. */
INLINE _GL_ATTRIBUTE_CONST
bool
INLINE _GL_ATTRIBUTE_CONST bool
pdumper_object_p (const void *obj)
{
#ifdef HAVE_PDUMPER
@ -163,8 +158,7 @@ extern bool pdumper_cold_object_p_impl (const void *obj);
Only bool-vectors and floats should end up there.
pdumper_object_p() and pdumper_object_p_precise() must have
returned true for OBJ before calling this function. */
INLINE _GL_ATTRIBUTE_CONST
bool
INLINE _GL_ATTRIBUTE_CONST bool
pdumper_cold_object_p (const void *obj)
{
#ifdef HAVE_PDUMPER
@ -181,8 +175,7 @@ extern enum Lisp_Type pdumper_find_object_type_impl (const void *obj);
/* Return the type of the dumped object that starts at OBJ. It is a
programming error to call this routine for an OBJ for which
pdumper_object_p would return false. */
INLINE _GL_ATTRIBUTE_CONST
enum Lisp_Type
INLINE _GL_ATTRIBUTE_CONST enum Lisp_Type
pdumper_find_object_type (const void *obj)
{
#ifdef HAVE_PDUMPER
@ -197,8 +190,7 @@ pdumper_find_object_type (const void *obj)
the loaded dump image. It is a programming error to call this
routine for an OBJ for which pdumper_object_p would return
false. */
INLINE _GL_ATTRIBUTE_CONST
bool
INLINE _GL_ATTRIBUTE_CONST bool
pdumper_object_p_precise (const void *obj)
{
#ifdef HAVE_PDUMPER
@ -214,8 +206,7 @@ extern bool pdumper_marked_p_impl (const void *obj);
/* Return whether OBJ is marked according to the portable dumper.
It is an error to call this routine for an OBJ for which
pdumper_object_p_precise would return false. */
INLINE
bool
INLINE bool
pdumper_marked_p (const void *obj)
{
#ifdef HAVE_PDUMPER
@ -231,8 +222,7 @@ extern void pdumper_set_marked_impl (const void *obj);
/* Set the pdumper mark bit for OBJ. It is a programming error to
call this function with an OBJ for which pdumper_object_p_precise
would return false. */
INLINE
void
INLINE void
pdumper_set_marked (const void *obj)
{
#ifdef HAVE_PDUMPER
@ -246,8 +236,7 @@ pdumper_set_marked (const void *obj)
extern void pdumper_clear_marks_impl (void);
/* Clear all the mark bits for pdumper objects. */
INLINE
void
INLINE void
pdumper_clear_marks (void)
{
#ifdef HAVE_PDUMPER
@ -255,11 +244,6 @@ pdumper_clear_marks (void)
#endif
}
/* Handle a page fault that occurs when we access the portable dumper
mapping. Return true iff the fault should be considered handled
and execution should resume. */
bool pdumper_handle_page_fault (void *fault_addr_ptr);
/* Record the Emacs startup directory, relative to which the pdump
file was loaded. */
extern void pdumper_record_wd (const char *);

View file

@ -1893,7 +1893,7 @@ handle_sigsegv (int sig, siginfo_t *siginfo, void *arg)
/* Return true if we have successfully set up SIGSEGV handler on alternate
stack. Otherwise we just treat SIGSEGV among the rest of fatal signals. */
bool
static bool
init_sigsegv (void)
{
struct sigaction sa;
@ -1916,7 +1916,7 @@ init_sigsegv (void)
#else /* not HAVE_STACK_OVERFLOW_HANDLING or WINDOWSNT */
bool
static bool
init_sigsegv (void)
{
return 0;

View file

@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <signal.h>
extern void init_signals (void);
extern bool init_sigsegv (void);
extern void block_child_signal (sigset_t *);
extern void unblock_child_signal (sigset_t const *);
extern void block_interrupt_signal (sigset_t *);

View file

@ -81,7 +81,7 @@ Lisp_Object selected_window;
/* The value of selected_window at the last time window change
functions were run. This is always the same as
FRAME_OLD_SELECTED_WINDOW (old_selected_frame). */
Lisp_Object old_selected_window;
static Lisp_Object old_selected_window;
/* A list of all windows for use by next_window and Fwindow_list.
Functions creating or deleting windows should invalidate this cache

View file

@ -1039,7 +1039,6 @@ wset_next_buffers (struct window *w, Lisp_Object val)
This value is always the same as FRAME_SELECTED_WINDOW (selected_frame). */
extern Lisp_Object selected_window;
extern Lisp_Object old_selected_window;
/* This is a time stamp for window selection, so we can find the least
recently used window. Its only users are Fselect_window,