Commit a3a6c54e authored by Paul Eggert's avatar Paul Eggert
Browse files

Merge: Fix more problems found by GCC 4.5.2's static checks.

parents d6cd56f1 b1d876f1
2011-03-17 Paul Eggert <eggert@cs.ucla.edu>
Fix more problems found by GCC 4.5.2's static checks.
* process.c (make_serial_process_unwind, send_process_trap):
(sigchld_handler): Now static.
* process.c (allocate_pty): Let PTY_ITERATION declare iteration vars.
That way, the code declares only the vars that it needs.
* s/aix4-2.h (PTY_ITERATION): Declare iteration vars.
* s/cygwin.h (PTY_ITERATION): Likewise.
* s/darwin.h (PTY_ITERATION): Likewise.
* s/gnu-linux.h (PTY_ITERATION): Likewise.
* s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling.
* process.c (allocate_pty): Don't declare stb unless it's needed.
* bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else".
(CONSTANTLIM): Remove; unused.
(METER_CODE, Bscan_buffer, Bread_char, Bset_mark):
Define only if needed.
* unexelf.c (unexec): Name an expression,
to avoid gcc -Wbad-function-cast warning.
Use a different way to cause a compilation error if anyone uses
n rather than nn, a way that does not involve shadowing.
(ELF_BSS_SECTION_NAME, OLD_PROGRAM_H): Remove; unused.
* deps.mk (unexalpha.o): Remove; unused.
New file unexec.h, the (simple) interface for unexec (Bug#8267).
* unexec.h: New file.
* deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o):
(unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o):
Depend on unexec.h.
* emacs.c [!defined CANNOT_DUMP]: Include unexec.h.
* unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c:
* unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h.
* syntax.c (Fforward_comment, scan_lists): Rename locals to avoid
shadowing.
(back_comment, skip_chars): Mark vars as initialized.
* character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS):
Rename locals to avoid shadowing.
* lread.c (read1): Rewrite so as not to use empty "else".
(Fload, readevalloop, read1): Rename locals to avoid shadowing.
* print.c (Fredirect_debugging_output): Fix pointer signedess.
* lisp.h (debug_output_compilation_hack): Add decl here, to avoid
warning when compiling print.c.
* font.c (font_unparse_fcname): Abort in an "impossible" situation
instead of using an uninitialized var.
(font_sort_entities): Mark var as initialized.
* character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing.
* font.c (font_unparse_xlfd): Don't mix pointers to variables with
pointers to constants.
(font_parse_fcname): Remove unused vars.
(font_delete_unmatched): Now static.
(font_get_spec): Remove; unused.
(font_style_to_value, font_prop_validate_style, font_unparse_fcname):
(font_update_drivers, Ffont_get_glyphs, font_add_log):
Rename or move locals to avoid shadowing.
* fns.c (require_nesting_list, require_unwind): Now static.
(Ffillarray): Rename locals to avoid shadowing.
* floatfns.c (domain_error2): Define only if needed.
(Ffrexp, Fldexp): Rename locals to avoid shadowing.
* alloc.c (mark_backtrace): Move decl from here ...
* lisp.h: ... to here, so that it can be checked.
* eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static.
(Fdefvar): Rewrite so as not to use empty "else".
(lisp_indirect_variable): Name an expression,
to avoid gcc -Wbad-function-cast warning.
(Fdefvar): Rename locals to avoid shadowing.
* callint.c (quotify_arg, quotify_args): Now static.
(Fcall_interactively): Rename locals to avoid shadowing.
Use const pointer when appropriate.
* lisp.h (get_system_name, get_operating_system_release):
Move decls here, to check interfaces.
* process.c (get_operating_system_release): Move decl to lisp.h.
* xrdb.c (get_system_name): Likewise.
* editfns.c (init_editfns, Fuser_login_name, Fuser_uid):
(Fuser_real_uid, Fuser_full_name): Remove unnecessary casts,
some of which prompt warnings from gcc -Wbad-function-cast.
(Fformat_time_string, Fencode_time, Finsert_char):
(Ftranslate_region_internal, Fformat):
Rename or remove local vars to avoid shadowing.
(Ftranslate_region_internal): Mark var as initialized.
* doc.c (Fdocumentation, Fsnarf_documentation): Move locals to
avoid shadowing.
* lisp.h (eassert): Check that the argument compiles, even if
ENABLE_CHECKING is not defined.
* data.c (Findirect_variable): Name an expression, to avoid
gcc -Wbad-function-cast warning.
(default_value, arithcompare, arith_driver, arith_error): Now static.
(store_symval_forwarding): Rename local to avoid shadowing.
(Fmake_variable_buffer_local, Fmake_local_variable): Mark
variables as initialized.
(do_blv_forwarding, do_symval_forwarding): Remove; unused.
* alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST.
(Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect):
Rename locals to avoid shadowing.
(mark_stack): Move local variables into the #ifdef region where
they're used.
(BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Define only if
! defined SYSTEM_MALLOC && ! defined SYNC_INPUT, as they are not
needed otherwise.
(CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS.
(GC_STRING_CHARS): Remove; not used.
(Fmemory_limit): Cast sbrk's returned value to char *.
* lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this
avoids undefined behavior in theory.
* regex.c (IF_LINT): Add defn, for benefit of ../lib-src.
Use functions, not macros, for up- and down-casing (Bug#8254).
* buffer.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
(NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Remove. All callers changed
to use the following functions instead of these macros.
(downcase): Adjust to lack of DOWNCASE_TABLE. Return int, not
EMACS_INT, since callers assume the returned value fits in int.
(upcase1): Likewise, for UPCASE_TABLE.
(uppercasep, lowercasep, upcase): New static inline functions.
* editfns.c (Fchar_equal): Remove no-longer-needed workaround for
the race-condition problem in the old DOWNCASE.
* regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT):
Rename locals to avoid shadowing.
(regex_compile, re_match_2_internal): Move locals to avoid shadowing.
(regex_compile, re_search_2, re_match_2_internal):
Remove unused local vars.
(FREE_VAR): Rewrite so as not to use empty "else",
which gcc can warn about.
(regex_compile, re_match_2_internal): Mark locals as initialized.
(RETALLOC_IF): Define only if needed.
(WORDCHAR_P): Likewise. This one is never needed, but is used
only in a comment talking about a compiler bug, so put inside
the #if 0 of that comment.
(CHARSET_LOOKUP_BITMAP, FAIL_STACK_FULL, RESET_FAIL_STACK):
(PUSH_FAILURE_ELT, BUF_PUSH_3, STOP_ADDR_VSTRING):
Remove; unused.
* search.c (boyer_moore): Rename locals to avoid shadowing.
* character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE):
(PREV_CHAR_BOUNDARY): Likewise.
* search.c (simple_search): Remove unused var.
* dired.c (compile_pattern): Move decl from here ...
* lisp.h: ... to here, so that it can be checked.
(struct re_registers): New forward decl.
* character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing.
* indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width.
All uses changed.
(MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion):
Rename locals to avoid shadowing.
(Fvertical_motion): Mark locals as initialized.
* casefiddle.c (casify_object, casify_region): Now static.
(casify_region): Mark local as initialized.
* cmds.c (internal_self_insert): Rename local to avoid shadowing.
* lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR):
New macros, so that the caller can use some names other than
gcpro1, gcpro2, etc.
(GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6): Reimplement in terms
of the new macros.
(GCPRO1_VAR, UNGCPRO_VAR): Change the meaning of the second
argument, for consistency with GCPRO2_VAR, etc: it is now the
prefix of the variable, not the variable itself. All uses
changed.
* dired.c (directory_files_internal, file_name_completion):
Rename locals to avoid shadowing.
Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254).
An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in
dired.c's scmp function, had undefined behavior.
* lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
(NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ...
* buffer.h: ... to here, because these macros use current_buffer,
and the new implementation with inline functions needs to have
current_buffer in scope now, rather than later when the macros
are used.
(downcase, upcase1): New static inline functions.
(DOWNCASE, UPCASE1): Reimplement using these functions.
This avoids undefined behavior in expressions like
DOWNCASE (x) == DOWNCASE (y), which previously suffered
from race conditions in accessing the global variables
case_temp1 and case_temp2.
* casetab.c (case_temp1, case_temp2): Remove; no longer needed.
* lisp.h (case_temp1, case_temp2): Remove their decls.
* character.h (ASCII_CHAR_P): Move from here ...
* lisp.h: ... to here, so that the inline functions mentioned
above can use them.
* dired.c (directory_files_internal_unwind): Now static.
* fileio.c (file_name_as_directory, directory_file_name):
(barf_or_query_if_file_exists, auto_save_error, auto_save_1):
Now static.
(file_name_as_directory): Use const pointers when appropriate.
(Fexpand_file_name): Likewise. In particular, newdir might
point at constant storage, so make it a const pointer.
(Fmake_directory_internal, Fread_file_name): Remove unused vars.
(Ffile_selinux_context, Fset_file_selinux_context): Fix pointer
signedness issues.
(Fset_file_times, Finsert_file_contents, auto_save_error):
Rename locals to avoid shadowing.
* minibuf.c (choose_minibuf_frame_1): Now static.
(Ftry_completion, Fall_completions): Rename or remove locals
to avoid shadowing.
* marker.c (bytepos_to_charpos): Remove; unused.
* lisp.h (verify_bytepos, count_markers): New decls,
so that gcc does not warn that these functions aren't declared.
* insdel.c (check_markers, make_gap_larger, make_gap_smaller):
(reset_var_on_error, Fcombine_after_change_execute_1): Now static.
(CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic.
(copy_text): Remove unused local var.
* filelock.c (within_one_second): Now static.
(lock_file_1): Rename local to avoid shadowing.
* buffer.c (fix_overlays_before): Mark locals as initialized.
(fix_start_end_in_overlays): Likewise. This function should be
simplified by using pointers-to-pointers, but that's a different
matter.
(switch_to_buffer_1): Now static.
(Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte):
(report_overlay_modification): Rename locals to avoid shadowing.
* sysdep.c (system_process_attributes): Rename vars to avoid shadowing.
Fix pointer signedness issue.
(sys_subshell): Mark local as volatile if checking for lint,
to suppress a gcc -Wclobbered warning that does not seem to be right.
(MAXPATHLEN): Define only if needed.
* process.c (serial_open, serial_configure): Move decls from here ...
* systty.h: ... to here, so that they can be checked.
* fns.c (get_random, seed_random): Move extern decls from here ...
* lisp.h: ... to here, so that they can be checked.
* sysdep.c (reset_io): Now static.
(wait_for_termination_signal): Remove; unused.
* keymap.c (keymap_parent, keymap_memberp, map_keymap_internal):
(copy_keymap_item, append_key, push_text_char_description):
Now static.
(Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily.
(DENSE_TABLE_SIZE): Remove; unused.
(get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal):
(describe_map_tree):
Rename locals to avoid shadowing.
* keyboard.c: Declare functions static if they are not used elsewhere.
(echo_char, echo_dash, cmd_error, top_level_2):
(poll_for_input, handle_async_input): Now static.
(read_char, kbd_buffer_get_event, make_lispy_position):
(make_lispy_event, make_lispy_movement, apply_modifiers):
(decode_keyboard_code, tty_read_avail_input, menu_bar_items):
(parse_tool_bar_item, read_key_sequence, Fread_key_sequence):
(Fread_key_sequence_vector): Rename locals to avoid shadowing.
(read_key_sequence, read_char): Mark locals as initialized.
(Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN.
* keyboard.h (make_ctrl_char): New decl.
(mark_kboards): Move decl here ...
* alloc.c (mark_kboards): ... from here.
* lisp.h (force_auto_save_soon): New decl.
* emacs.c (init_cmdargs): Rename local to avoid shadowing.
(DEFINE_DUMMY_FUNCTION): New macro.
(__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main):
Use it.
(main): Add casts to avoid warnings
if GCC considers string literals to be constants.
* lisp.h (fatal_error_signal): Add decl, since it's exported.
* dbusbind.c: Pointer signedness fixes.
(xd_signature, xd_append_arg, xd_initialize):
(Fdbus_call_method, Fdbus_call_method_asynchronously):
(Fdbus_method_return_internal, Fdbus_method_error_internal):
(Fdbus_send_signal, xd_read_message_1, Fdbus_register_service):
(Fdbus_register_signal): Use SSDATA when the context wants char *.
* dbusbind.c (Fdbus_init_bus): Add cast to avoid warning
if GCC considers string literals to be constants.
(Fdbus_register_service, Fdbus_register_method): Remove unused vars.
2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
 
* print.c (PRINT_CIRCLE_CANDIDATE_P): New macro.
......@@ -92,7 +92,8 @@ extern __malloc_size_t __malloc_extra_blocks;
#endif /* not DOUG_LEA_MALLOC */
#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD)
#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT
#ifdef HAVE_GTK_AND_PTHREAD
/* When GTK uses the file chooser dialog, different backends can be loaded
dynamically. One such a backend is the Gnome VFS backend that gets loaded
......@@ -130,12 +131,13 @@ static pthread_mutex_t alloc_mutex;
} \
while (0)
#else /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */
#else /* ! defined HAVE_GTK_AND_PTHREAD */
#define BLOCK_INPUT_ALLOC BLOCK_INPUT
#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT
#endif /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */
#endif /* ! defined HAVE_GTK_AND_PTHREAD */
#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */
/* Value of _bytes_used, when spare_memory was freed. */
......@@ -152,13 +154,11 @@ static __malloc_size_t bytes_used_when_full;
#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG)
#define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0)
/* Value is the number of bytes/chars of S, a pointer to a struct
Lisp_String. This must be used instead of STRING_BYTES (S) or
S->size during GC, because S->size contains the mark bit for
/* Value is the number of bytes of S, a pointer to a struct Lisp_String.
Be careful during GC, because S->size contains the mark bit for
strings. */
#define GC_STRING_BYTES(S) (STRING_BYTES (S))
#define GC_STRING_CHARS(S) ((S)->size & ~ARRAY_MARK_FLAG)
/* Global variables. */
struct emacs_globals globals;
......@@ -270,8 +270,6 @@ Lisp_Object Qpost_gc_hook;
static void mark_buffer (Lisp_Object);
static void mark_terminals (void);
extern void mark_kboards (void);
extern void mark_backtrace (void);
static void gc_sweep (void);
static void mark_glyph_matrix (struct glyph_matrix *);
static void mark_face_cache (struct face_cache *);
......@@ -2654,17 +2652,17 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
return val;
}
#ifdef GC_CHECK_CONS_LIST
/* Get an error now if there's any junk in the cons free list. */
void
check_cons_list (void)
{
#ifdef GC_CHECK_CONS_LIST
struct Lisp_Cons *tail = cons_free_list;
while (tail)
tail = tail->u.chain;
#endif
}
#endif
/* Make a list of 1, 2, 3, 4 or 5 specified objects. */
......@@ -2904,15 +2902,15 @@ See also the function `vector'. */)
{
Lisp_Object vector;
register EMACS_INT sizei;
register EMACS_INT index;
register EMACS_INT i;
register struct Lisp_Vector *p;
CHECK_NATNUM (length);
sizei = XFASTINT (length);
p = allocate_vector (sizei);
for (index = 0; index < sizei; index++)
p->contents[index] = init;
for (i = 0; i < sizei; i++)
p->contents[i] = init;
XSETVECTOR (vector, p);
return vector;
......@@ -2926,14 +2924,14 @@ usage: (vector &rest OBJECTS) */)
(register int nargs, Lisp_Object *args)
{
register Lisp_Object len, val;
register int index;
register int i;
register struct Lisp_Vector *p;
XSETFASTINT (len, nargs);
val = Fmake_vector (len, Qnil);
p = XVECTOR (val);
for (index = 0; index < nargs; index++)
p->contents[index] = args[index];
for (i = 0; i < nargs; i++)
p->contents[i] = args[i];
return val;
}
......@@ -2948,7 +2946,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
(register int nargs, Lisp_Object *args)
{
register Lisp_Object len, val;
register int index;
register int i;
register struct Lisp_Vector *p;
XSETFASTINT (len, nargs);
......@@ -2966,11 +2964,11 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
args[1] = Fstring_as_unibyte (args[1]);
p = XVECTOR (val);
for (index = 0; index < nargs; index++)
for (i = 0; i < nargs; i++)
{
if (!NILP (Vpurify_flag))
args[index] = Fpurecopy (args[index]);
p->contents[index] = args[index];
args[i] = Fpurecopy (args[i]);
p->contents[i] = args[i];
}
XSETPVECTYPE (p, PVEC_COMPILED);
XSETCOMPILED (val, p);
......@@ -4313,12 +4311,6 @@ static void
mark_stack (void)
{
int i;
/* jmp_buf may not be aligned enough on darwin-ppc64 */
union aligned_jmpbuf {
Lisp_Object o;
jmp_buf j;
} j;
volatile int stack_grows_down_p = (char *) &j > (char *) stack_base;
void *end;
#ifdef HAVE___BUILTIN_UNWIND_INIT
......@@ -4328,6 +4320,14 @@ mark_stack (void)
__builtin_unwind_init ();
end = &end;
#else /* not HAVE___BUILTIN_UNWIND_INIT */
#ifndef GC_SAVE_REGISTERS_ON_STACK
/* jmp_buf may not be aligned enough on darwin-ppc64 */
union aligned_jmpbuf {
Lisp_Object o;
jmp_buf j;
} j;
volatile int stack_grows_down_p = (char *) &j > (char *) stack_base;
#endif
/* This trick flushes the register windows so that all the state of
the process is contained in the stack. */
/* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is
......@@ -5064,18 +5064,18 @@ returns nil, because real GC can't be done. */)
if (FLOATP (Vgc_cons_percentage))
{ /* Set gc_cons_combined_threshold. */
EMACS_INT total = 0;
total += total_conses * sizeof (struct Lisp_Cons);
total += total_symbols * sizeof (struct Lisp_Symbol);
total += total_markers * sizeof (union Lisp_Misc);
total += total_string_size;
total += total_vector_size * sizeof (Lisp_Object);
total += total_floats * sizeof (struct Lisp_Float);
total += total_intervals * sizeof (struct interval);
total += total_strings * sizeof (struct Lisp_String);
gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage);
EMACS_INT tot = 0;
tot += total_conses * sizeof (struct Lisp_Cons);
tot += total_symbols * sizeof (struct Lisp_Symbol);
tot += total_markers * sizeof (union Lisp_Misc);
tot += total_string_size;
tot += total_vector_size * sizeof (Lisp_Object);
tot += total_floats * sizeof (struct Lisp_Float);
tot += total_intervals * sizeof (struct interval);
tot += total_strings * sizeof (struct Lisp_String);
gc_relative_threshold = tot * XFLOAT_DATA (Vgc_cons_percentage);
}
else
gc_relative_threshold = 0;
......@@ -5124,9 +5124,9 @@ returns nil, because real GC can't be done. */)
if (!NILP (Vpost_gc_hook))
{
int count = inhibit_garbage_collection ();
int gc_count = inhibit_garbage_collection ();
safe_run_hooks (Qpost_gc_hook);
unbind_to (count, Qnil);
unbind_to (gc_count, Qnil);
}
/* Accumulate statistics. */
......@@ -5305,7 +5305,6 @@ mark_object (Lisp_Object arg)
#else /* not GC_CHECK_MARKED_OBJECTS */
#define CHECK_ALLOCATED() (void) 0
#define CHECK_LIVE(LIVEP) (void) 0
#define CHECK_ALLOCATED_AND_LIVE(LIVEP) (void) 0
......@@ -6057,7 +6056,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer. */)
{
Lisp_Object end;
XSETINT (end, (EMACS_INT) sbrk (0) / 1024);
XSETINT (end, (EMACS_INT) (char *) sbrk (0) / 1024);
return end;
}
......
......@@ -1464,9 +1464,9 @@ with SIGHUP. */)
don't re-kill them. */
if (other->base_buffer == b && !NILP (BVAR (other, name)))
{
Lisp_Object buffer;
XSETBUFFER (buffer, other);
Fkill_buffer (buffer);
Lisp_Object buf;
XSETBUFFER (buf, other);
Fkill_buffer (buf);
}
UNGCPRO;
......@@ -1527,9 +1527,9 @@ with SIGHUP. */)
&& BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
&& NILP (Fsymbol_value (intern ("auto-save-visited-file-name"))))
{
Lisp_Object tem;
tem = Fsymbol_value (intern ("delete-auto-save-files"));
if (! NILP (tem))
Lisp_Object delete;
delete = Fsymbol_value (intern ("delete-auto-save-files"));
if (! NILP (delete))
internal_delete_file (BVAR (b, auto_save_file_name));
}
......@@ -1601,19 +1601,19 @@ with SIGHUP. */)
void
record_buffer (Lisp_Object buf)
{
register Lisp_Object link, prev;
register Lisp_Object list, prev;
Lisp_Object frame;
frame = selected_frame;
prev = Qnil;
for (link = Vbuffer_alist; CONSP (link); link = XCDR (link))
for (list = Vbuffer_alist; CONSP (list); list = XCDR (list))
{
if (EQ (XCDR (XCAR (link)), buf))
if (EQ (XCDR (XCAR (list)), buf))
break;
prev = link;
prev = list;
}
/* Effectively do Vbuffer_alist = Fdelq (link, Vbuffer_alist);
/* Effectively do Vbuffer_alist = Fdelq (list, Vbuffer_alist);
we cannot use Fdelq itself here because it allows quitting. */
if (NILP (prev))
......@@ -1621,40 +1621,40 @@ record_buffer (Lisp_Object buf)
else
XSETCDR (prev, XCDR (XCDR (prev)));
XSETCDR (link, Vbuffer_alist);
Vbuffer_alist = link;
XSETCDR (list, Vbuffer_alist);
Vbuffer_alist = list;
/* Effectively do a delq on buried_buffer_list. */
prev = Qnil;
for (link = XFRAME (frame)->buried_buffer_list; CONSP (link);
link = XCDR (link))
for (list = XFRAME (frame)->buried_buffer_list; CONSP (list);
list = XCDR (list))
{
if (EQ (XCAR (link), buf))
if (EQ (XCAR (list), buf))
{
if (NILP (prev))
XFRAME (frame)->buried_buffer_list = XCDR (link);
XFRAME (frame)->buried_buffer_list = XCDR (list);
else
XSETCDR (prev, XCDR (XCDR (prev)));
break;
}
prev = link;
prev = list;
}
/* Now move this buffer to the front of frame_buffer_list also. */
prev = Qnil;
for (link = frame_buffer_list (frame); CONSP (link);
link = XCDR (link))
for (list = frame_buffer_list (frame); CONSP (list);
list = XCDR (list))
{
if (EQ (XCAR (link), buf))
if (EQ (XCAR (list), buf))
break;
prev = link;
prev = list;
}
/* Effectively do delq. */
if (CONSP (link))
if (CONSP (list))
{
if (NILP (prev))
set_frame_buffer_list (frame,
......@@ -1662,8 +1662,8 @@ record_buffer (Lisp_Object buf)
else
XSETCDR (prev, XCDR (XCDR (prev)));
XSETCDR (link, frame_buffer_list (frame));
set_frame_buffer_list (frame, link);
XSETCDR (list, frame_buffer_list (frame));
set_frame_buffer_list (frame, list);
}
else
set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame)));
......@@ -1712,7 +1712,7 @@ the current buffer's major mode. */)
/* Switch to buffer BUFFER in the selected window.
If NORECORD is non-nil, don't call record_buffer. */
Lisp_Object
static Lisp_Object
switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord)
{
register Lisp_Object buffer;
......@@ -1984,13 +1984,13 @@ its frame, iconify that frame. */)