changeset 86348:4505355014c0

(do_symval_forwarding): Use same code as in find_symbol_value. (find_symbol_value): Use do_symval_forwarding.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 22 Nov 2007 20:29:48 +0000
parents b534e35f5d2e
children 4798723a9c9c
files src/ChangeLog src/data.c
diffstat 2 files changed, 8 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Nov 22 20:28:14 2007 +0000
+++ b/src/ChangeLog	Thu Nov 22 20:29:48 2007 +0000
@@ -1,5 +1,8 @@
 2007-11-22  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* data.c (do_symval_forwarding): Use same code as in find_symbol_value.
+	(find_symbol_value): Use do_symval_forwarding.
+
 	* data.c (set_internal): Set the value in the `cons-cell' (for
 	Buffer_Local_values) not only for frame-local variables.
 
--- a/src/data.c	Thu Nov 22 20:28:14 2007 +0000
+++ b/src/data.c	Thu Nov 22 20:29:48 2007 +0000
@@ -864,7 +864,6 @@
      register Lisp_Object valcontents;
 {
   register Lisp_Object val;
-  int offset;
   if (MISCP (valcontents))
     switch (XMISCTYPE (valcontents))
       {
@@ -879,11 +878,10 @@
 	return *XOBJFWD (valcontents)->objvar;
 
       case Lisp_Misc_Buffer_Objfwd:
-	offset = XBUFFER_OBJFWD (valcontents)->offset;
-	return PER_BUFFER_VALUE (current_buffer, offset);
+	return PER_BUFFER_VALUE (current_buffer,
+				 XBUFFER_OBJFWD (valcontents)->offset);
 
       case Lisp_Misc_Kboard_Objfwd:
-	offset = XKBOARD_OBJFWD (valcontents)->offset;
         /* We used to simply use current_kboard here, but from Lisp
            code, it's value is often unexpected.  It seems nicer to
            allow constructions like this to work as intuitively expected:
@@ -895,7 +893,8 @@
            last-command and real-last-command, and people may rely on
            that.  I took a quick look at the Lisp codebase, and I
            don't think anything will break.  --lorentey  */
-	return *(Lisp_Object *)(offset + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
+	return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
+				+ (char *)FRAME_KBOARD (SELECTED_FRAME ()));
       }
   return valcontents;
 }
@@ -1104,31 +1103,7 @@
   if (BUFFER_LOCAL_VALUEP (valcontents))
     valcontents = swap_in_symval_forwarding (symbol, valcontents);
 
-  if (MISCP (valcontents))
-    {
-      switch (XMISCTYPE (valcontents))
-	{
-	case Lisp_Misc_Intfwd:
-	  XSETINT (val, *XINTFWD (valcontents)->intvar);
-	  return val;
-
-	case Lisp_Misc_Boolfwd:
-	  return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
-
-	case Lisp_Misc_Objfwd:
-	  return *XOBJFWD (valcontents)->objvar;
-
-	case Lisp_Misc_Buffer_Objfwd:
-	  return PER_BUFFER_VALUE (current_buffer,
-				     XBUFFER_OBJFWD (valcontents)->offset);
-
-	case Lisp_Misc_Kboard_Objfwd:
-	  return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
-				  + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
-	}
-    }
-
-  return valcontents;
+  return do_symval_forwarding (valcontents);
 }
 
 DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,