aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.c
diff options
context:
space:
mode:
authorPaul Eggert2016-06-14 11:46:30 -0700
committerPaul Eggert2016-06-14 12:21:00 -0700
commit7f35d5cbaf055dddcf0489a6f6a46df7ddaeeaf4 (patch)
tree05f14fed6b802043127ab5dfda073fea0860a98e /src/doc.c
parent61cfd6acfe099bae4b743665d0a10c2ba55e7ff2 (diff)
downloademacs-7f35d5cbaf055dddcf0489a6f6a46df7ddaeeaf4.tar.gz
emacs-7f35d5cbaf055dddcf0489a6f6a46df7ddaeeaf4.zip
Remove recursion from store_function_docstring
* src/doc.c (store_function_docstring): Refactor to avoid the need for C-level recursion.
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/doc.c b/src/doc.c
index 017dd173d0a..7107580cf8b 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -481,15 +481,10 @@ store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
481 481
482 /* The type determines where the docstring is stored. */ 482 /* The type determines where the docstring is stored. */
483 483
484 /* Lisp_Subrs have a slot for it. */
485 if (SUBRP (fun))
486 {
487 intptr_t negative_offset = - offset;
488 XSUBR (fun)->doc = (char *) negative_offset;
489 }
490
491 /* If it's a lisp form, stick it in the form. */ 484 /* If it's a lisp form, stick it in the form. */
492 else if (CONSP (fun)) 485 if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
486 fun = XCDR (fun);
487 if (CONSP (fun))
493 { 488 {
494 Lisp_Object tem; 489 Lisp_Object tem;
495 490
@@ -503,8 +498,13 @@ store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
503 correctness is quite delicate. */ 498 correctness is quite delicate. */
504 XSETCAR (tem, make_number (offset)); 499 XSETCAR (tem, make_number (offset));
505 } 500 }
506 else if (EQ (tem, Qmacro)) 501 }
507 store_function_docstring (XCDR (fun), offset); 502
503 /* Lisp_Subrs have a slot for it. */
504 else if (SUBRP (fun))
505 {
506 intptr_t negative_offset = - offset;
507 XSUBR (fun)->doc = (char *) negative_offset;
508 } 508 }
509 509
510 /* Bytecode objects sometimes have slots for it. */ 510 /* Bytecode objects sometimes have slots for it. */