Mercurial > emacs
changeset 89323:6ca0b3586d5f
(apropos_predicate, apropos_accumulate): Declare
static.
(Fapropos_internal): Don't gcpro apropos_accumulate. Set result
to new local and nullify apropos_accumulate before returning.
(syms_of_keymap): Staticpro and initialize apropos_accumulate.
author | Dave Love <fx@gnu.org> |
---|---|
date | Fri, 03 Jan 2003 20:24:54 +0000 |
parents | dcddf6c63960 |
children | 7f05ba2b8954 |
files | src/keymap.c |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/keymap.c Thu Dec 12 19:42:58 2002 +0000 +++ b/src/keymap.c Fri Jan 03 20:24:54 2003 +0000 @@ -1,5 +1,5 @@ /* Manipulation of keymaps - Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000, 2001 + Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000, 01, 02, 03 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -3266,8 +3266,8 @@ /* Apropos - finding all symbols whose names match a regexp. */ -Lisp_Object apropos_predicate; -Lisp_Object apropos_accumulate; +static Lisp_Object apropos_predicate; +static Lisp_Object apropos_accumulate; static void apropos_accum (symbol, string) @@ -3283,22 +3283,24 @@ } DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0, - doc: /* Show all symbols whose names contain match for REGEXP. + doc: /* Find all symbols whose names contain match for REGEXP. If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done for each symbol and a symbol is mentioned only if that returns non-nil. Return list of symbols found. */) (regexp, predicate) Lisp_Object regexp, predicate; { - struct gcpro gcpro1, gcpro2; + struct gcpro gcpro1; + Lisp_Object result; CHECK_STRING (regexp); apropos_predicate = predicate; - GCPRO2 (apropos_predicate, apropos_accumulate); - apropos_accumulate = Qnil; + GCPRO1 (apropos_predicate); + apropos_accumulate = Qnil; /* staticpro'd */ map_obarray (Vobarray, apropos_accum, regexp); - apropos_accumulate = Fsort (apropos_accumulate, Qstring_lessp); + result = Fsort (apropos_accumulate, Qstring_lessp); UNGCPRO; - return apropos_accumulate; + apropos_accumulate = Qnil; /* Allow the result to be GCed. */ + return result; } void @@ -3432,6 +3434,8 @@ where_is_cache = Qnil; staticpro (&where_is_cache); staticpro (&where_is_cache_keymaps); + apropos_accumulate = Qnil; + staticpro (&apropos_accumulate); defsubr (&Skeymapp); defsubr (&Skeymap_parent);