Mercurial > hg > xemacs-beta
diff src/symbols.c @ 343:8bec6624d99b r21-1-1
Import from CVS: tag r21-1-1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:52:53 +0200 |
parents | 558f606b08ae |
children | 972bbb6d6ca2 |
line wrap: on
line diff
--- a/src/symbols.c Mon Aug 13 10:52:06 2007 +0200 +++ b/src/symbols.c Mon Aug 13 10:52:53 2007 +0200 @@ -98,8 +98,6 @@ ((markobj) (sym->value)); ((markobj) (sym->function)); - /* No need to mark through ->obarray, because it only holds nil or t. */ - /*((markobj) (sym->obarray));*/ XSETSTRING (pname, sym->name); ((markobj) (pname)); if (!symbol_next (sym)) @@ -192,17 +190,9 @@ if (purify_flag && ! purified (str)) str = make_pure_pname (XSTRING_DATA (str), len, 0); sym = Fmake_symbol (str); - /* FSFmacs places OBARRAY here, but it is pointless because we do - not mark through this slot, so it is not usable later (because - the obarray might have been collected). Marking through the - ->obarray slot is an even worse idea, because it would keep - obarrays from being collected because of symbols pointed to them. - - NOTE: We place Qt here only if OBARRAY is actually Vobarray. It - is safer to do it this way, to avoid hosing with symbols within - pure objects. */ - if (EQ (obarray, Vobarray)) - XSYMBOL (sym)->obarray = Qt; + /* FSFmacs places OBARRAY here, but it we know better. See lisp.h + for a little explanation. */ + XSYMBOL_OBARRAY_FLAGS (sym) = 1 | (2 * EQ (Vobarray, obarray)); if (SYMBOLP (*ptr)) symbol_next (XSYMBOL (sym)) = XSYMBOL (*ptr); @@ -287,7 +277,13 @@ } } } - XSYMBOL (tem)->obarray = Qnil; + if (XSYMBOL_OBARRAY_FLAGS (tem) & 4) + { + /* Symbol was stored somewhere in a pure structure, so it needs + at least one existing reference. Make one. */ + Fputhash (tem, Qnil, Vpure_uninterned_symbol_table); + } + XSYMBOL_OBARRAY_FLAGS (tem) &= ~3; return Qt; } @@ -561,7 +557,7 @@ if (symbol_is_constant (sym, val) || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym) - && !NILP (XSYMBOL (sym)->obarray))) + && (XSYMBOL_OBARRAY_FLAGS (sym) & 2))) signal_error (Qsetting_constant, UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); } @@ -3162,6 +3158,7 @@ XSYMBOL (Qnil)->name->plist = Qnil; XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */ XSYMBOL (Qnil)->plist = Qnil; + XSYMBOL_OBARRAY_FLAGS (Qnil) = 1 | 2; Vobarray = make_vector (OBARRAY_SIZE, Qzero); initial_obarray = Vobarray; @@ -3170,7 +3167,6 @@ { int hash = hash_string (string_data (XSYMBOL (Qnil)->name), 3); XVECTOR_DATA (Vobarray)[hash % OBARRAY_SIZE] = Qnil; - XSYMBOL (Qnil)->obarray = Qt; } {