emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7f35d5c 1/2: Remove recursion from store_function_d


From: Paul Eggert
Subject: [Emacs-diffs] master 7f35d5c 1/2: Remove recursion from store_function_docstring
Date: Tue, 14 Jun 2016 19:21:04 +0000 (UTC)

branch: master
commit 7f35d5cbaf055dddcf0489a6f6a46df7ddaeeaf4
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Remove recursion from store_function_docstring
    
    * src/doc.c (store_function_docstring):
    Refactor to avoid the need for C-level recursion.
---
 src/doc.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/doc.c b/src/doc.c
index 017dd17..7107580 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -481,15 +481,10 @@ store_function_docstring (Lisp_Object obj, ptrdiff_t 
offset)
 
   /* The type determines where the docstring is stored.  */
 
-  /* Lisp_Subrs have a slot for it.  */
-  if (SUBRP (fun))
-    {
-      intptr_t negative_offset = - offset;
-      XSUBR (fun)->doc = (char *) negative_offset;
-    }
-
   /* If it's a lisp form, stick it in the form.  */
-  else if (CONSP (fun))
+  if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
+    fun = XCDR (fun);
+  if (CONSP (fun))
     {
       Lisp_Object tem;
 
@@ -503,8 +498,13 @@ store_function_docstring (Lisp_Object obj, ptrdiff_t 
offset)
               correctness is quite delicate.  */
            XSETCAR (tem, make_number (offset));
        }
-      else if (EQ (tem, Qmacro))
-       store_function_docstring (XCDR (fun), offset);
+    }
+
+  /* Lisp_Subrs have a slot for it.  */
+  else if (SUBRP (fun))
+    {
+      intptr_t negative_offset = - offset;
+      XSUBR (fun)->doc = (char *) negative_offset;
     }
 
   /* Bytecode objects sometimes have slots for it.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]