changeset 4134:ac5a714be3a2

[xemacs-hg @ 2007-08-21 20:32:33 by aidan] Don't use args to XINT_OR_CHAR where multiple evaluation is possible; revise X_I_O_C to not multiply evaluate.
author aidan
date Tue, 21 Aug 2007 20:32:37 +0000
parents 5b55fa103aa1
children cee641a27bba
files src/ChangeLog src/lisp.h src/mule-ccl.c
diffstat 3 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Aug 21 12:39:15 2007 +0000
+++ b/src/ChangeLog	Tue Aug 21 20:32:37 2007 +0000
@@ -1,3 +1,12 @@
+2007-08-21  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* mule-ccl.c (ccl_driver):
+	Don't pass XCHAR_OR_INT an argument of which the evaluation has
+	side effects; thank you Mike Fabian. 
+	* lisp.h: 
+	Redundantly, don't multiply evaluate the argument to XCHAR_OR_INT; 
+	this should prevent the same error in the future. 
+
 2007-08-17  Marcus Crestani  <crestani@xemacs.org>
 
 	* mc-alloc.c (L1_INDEX):
--- a/src/lisp.h	Tue Aug 21 12:39:15 2007 +0000
+++ b/src/lisp.h	Tue Aug 21 20:32:37 2007 +0000
@@ -2890,7 +2890,15 @@
 
 #else /* no error checking */
 
-#define XCHAR_OR_INT(obj) (CHARP (obj) ? XCHAR (obj) : XINT (obj))
+/* obj is multiply eval'ed and not an lvalue; use an inline function instead
+   of a macro. */
+DECLARE_INLINE_HEADER (
+EMACS_INT
+XCHAR_OR_INT (Lisp_Object obj)
+)
+{
+  return CHARP (obj) ? XCHAR (obj) : XINT (obj);
+}
 
 #endif /* no error checking */
 
--- a/src/mule-ccl.c	Tue Aug 21 12:39:15 2007 +0000
+++ b/src/mule-ccl.c	Tue Aug 21 20:32:37 2007 +0000
@@ -1578,7 +1578,7 @@
 		Lisp_Object map, content, attrib, value;
 		int point, size, fin_ic;
 
-		j = XCHAR_OR_INT (ccl_prog[ic++]); /* number of maps. */
+		j = XCHAR_OR_INT (ccl_prog[ic]); ic++; /* number of maps. */
 		fin_ic = ic + j;
 		op = reg[rrr];
 		if ((j > reg[RRR]) && (j >= 0))
@@ -1693,7 +1693,7 @@
 		stack_idx_of_map_multiple = 0;
 
 		map_set_rest_length =
-		  XCHAR_OR_INT (ccl_prog[ic++]); /* number of maps and separators. */
+		  XCHAR_OR_INT (ccl_prog[ic]); ic++; /* number of maps and separators. */
 		fin_ic = ic + map_set_rest_length;
 		op = reg[rrr];
 
@@ -1880,7 +1880,7 @@
 	      {
 		Lisp_Object map, attrib, value, content;
 		int size, point;
-		j = XCHAR_OR_INT (ccl_prog[ic++]); /* map_id */
+		j = XCHAR_OR_INT (ccl_prog[ic]); ic++;/* map_id */
 		op = reg[rrr];
 		if (j >= XVECTOR (Vcode_conversion_map_vector)->size)
 		  {