[Top][All Lists]

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

Re: Using uniprop_table_lookup

From: Stefan Monnier
Subject: Re: Using uniprop_table_lookup
Date: Mon, 08 Aug 2011 21:32:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> I'm getting ready to use this feature instead of src/biditype.h.  I
>> understand that CHAR_TABLE_REF is usable for this job already, and the
>> updated way of using uniprop_table in bidi.c is this:

>> Lisp_Object bidi_class_table = uniprop_table (intern ("bidi-class"));
>> ...
>> Lisp_Object bidi_class = CHAR_TABLE_REF (CH, bidi_class_table);

>> If so, do I need to staticpro the bidi_class_table variable above?

> No.  All returned tables by uniprop_table are stored in
> Vchar_code_property_alist which is DEFVAR_LISPed in
> chartab.c.  It means that the next call of uniprop_table
> with the same PROP argument just returns the already loaded
> one, and thus fast.

But since Eli says that he initializes bidi_class_table only once and
never touches it again, if he doesn't staticpro that variable and
someone does someone changes Vchar_code_property_alist, you could end up
with bidi_class_table pointing to a dead object.

There's no point wasting time trying to figure out whether a global
Lisp_Object should be staticpro'd or not: just staticpro it and
move on.  In 99% of the cases it's the only safe choice and the
remaining 1% is not worth the trouble worrying about.


reply via email to

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