From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Using uniprop_table_lookup Date: Mon, 08 Aug 2011 21:32:27 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1312853560 11586 80.91.229.12 (9 Aug 2011 01:32:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 9 Aug 2011 01:32:40 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 09 03:32:36 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QqbBL-0008Tu-8L for ged-emacs-devel@m.gmane.org; Tue, 09 Aug 2011 03:32:35 +0200 Original-Received: from localhost ([::1]:42417 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqbBK-00049Q-G6 for ged-emacs-devel@m.gmane.org; Mon, 08 Aug 2011 21:32:34 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqbBI-000494-2u for emacs-devel@gnu.org; Mon, 08 Aug 2011 21:32:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqbBH-0004z2-1C for emacs-devel@gnu.org; Mon, 08 Aug 2011 21:32:31 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:15981 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqbBF-0004tM-ED; Mon, 08 Aug 2011 21:32:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EALONQE5FxKeo/2dsb2JhbABCpyd4gUABAQQBViMFCws0EhQYDSSIAL8NhkYEmziEHYQx X-IronPort-AV: E=Sophos;i="4.67,340,1309752000"; d="scan'208";a="130168084" Original-Received: from 69-196-167-168.dsl.teksavvy.com (HELO ceviche.home) ([69.196.167.168]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 08 Aug 2011 21:32:27 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id A75E96610B; Mon, 8 Aug 2011 21:32:27 -0400 (EDT) In-Reply-To: (Kenichi Handa's message of "Tue, 09 Aug 2011 09:55:17 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:143037 Archived-At: >> 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. Stefan