From: Paul Eggert Date: Mon, 26 Sep 2011 05:50:37 +0000 (-0700) Subject: * eval.c (Fprog1, Fprog2): Don't assume list length fits in int. Simplify. X-Git-Tag: emacs-24.2.90~471^2~6^2~190 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=856bbc8152110a354293411eac5c629da9f4f74f;p=emacs.git * eval.c (Fprog1, Fprog2): Don't assume list length fits in int. Simplify. --- diff --git a/src/ChangeLog b/src/ChangeLog index ff76a9a8c78..9a2590eb54e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,4 @@ -2011-09-25 Paul Eggert +2011-09-26 Paul Eggert * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE) @@ -269,6 +269,7 @@ Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Fapply, apply_lambda): Don't assume ptrdiff_t can hold fixnum. (grow_specpdl): Simplify allocation by using xpalloc. + (Fprog1, Fprog2): Don't assume list length fits in int. Simplify. * fileio.c (Ffind_file_name_handler, Fcopy_file, Frename_file) (Finsert_file_contents, Fwrite_region, Fdo_auto_save): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. diff --git a/src/eval.c b/src/eval.c index b4ef785b3c7..257b878395e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -373,23 +373,14 @@ usage: (prog1 FIRST BODY...) */) Lisp_Object val; register Lisp_Object args_left; struct gcpro gcpro1, gcpro2; - register int argnum = 0; - - if (NILP (args)) - return Qnil; args_left = args; val = Qnil; GCPRO2 (args, val); - do - { - Lisp_Object tem = eval_sub (XCAR (args_left)); - if (!(argnum++)) - val = tem; - args_left = XCDR (args_left); - } - while (CONSP (args_left)); + val = eval_sub (XCAR (args_left)); + while (CONSP (args_left = XCDR (args_left))) + eval_sub (XCAR (args_left)); UNGCPRO; return val; @@ -402,31 +393,12 @@ remaining args, whose values are discarded. usage: (prog2 FORM1 FORM2 BODY...) */) (Lisp_Object args) { - Lisp_Object val; - register Lisp_Object args_left; - struct gcpro gcpro1, gcpro2; - register int argnum = -1; - - val = Qnil; - - if (NILP (args)) - return Qnil; - - args_left = args; - val = Qnil; - GCPRO2 (args, val); + struct gcpro gcpro1; - do - { - Lisp_Object tem = eval_sub (XCAR (args_left)); - if (!(argnum++)) - val = tem; - args_left = XCDR (args_left); - } - while (CONSP (args_left)); + GCPRO1 (args); - UNGCPRO; - return val; + eval_sub (XCAR (args)); + RETURN_UNGCPRO (Fprog1 (XCDR (args))); } DEFUN ("setq", Fsetq, Ssetq, 0, UNEVALLED, 0,