From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: Pure strings (Re: Compilation to native) Date: Tue, 20 Apr 2004 08:39:41 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200404192339.IAA01663@etlken.m17n.org> References: <87eks0654s.fsf@sno.mundell.ukfsn.org> <87n06bp4ng.fsf@sno.mundell.ukfsn.org> <8765cwkejr.fsf@mail.jurta.org> <200404071157.UAA25094@etlken.m17n.org> <87oepvo4jz.fsf@mail.jurta.org> <200404132340.IAA14502@etlken.m17n.org> <87u0zniciw.fsf@mail.jurta.org> <87fzb5h4x7.fsf_-_@mail.jurta.org> <200404190636.PAA29191@etlken.m17n.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1082418817 29932 80.91.224.253 (19 Apr 2004 23:53:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 19 Apr 2004 23:53:37 +0000 (UTC) Cc: juri@jurta.org, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Apr 20 01:53:30 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BFiZu-0002LK-00 for ; Tue, 20 Apr 2004 01:53:30 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BFiZt-0004qF-00 for ; Tue, 20 Apr 2004 01:53:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BFiRk-0003zj-PK for emacs-devel@quimby.gnus.org; Mon, 19 Apr 2004 19:45:04 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BFiOB-0003BR-6S for emacs-devel@gnu.org; Mon, 19 Apr 2004 19:41:23 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BFiND-0002kx-T8 for emacs-devel@gnu.org; Mon, 19 Apr 2004 19:40:56 -0400 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BFiMe-0002Sh-To; Mon, 19 Apr 2004 19:39:49 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2]) by tsukuba.m17n.org (8.11.6p2/8.11.6) with ESMTP id i3JNdh809472; Tue, 20 Apr 2004 08:39:43 +0900 (JST) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) by fs.m17n.org (8.11.6p2/8.11.6) with ESMTP id i3JNdf913969; Tue, 20 Apr 2004 08:39:41 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id IAA01663; Tue, 20 Apr 2004 08:39:41 +0900 (JST) Original-To: monnier@iro.umontreal.ca In-reply-to: (message from Stefan Monnier on 19 Apr 2004 10:20:47 -0400) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21915 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21915 In article , Stefan Monnier writes: >> Yes. Isn't it better to do copy-sequence on the fly, for >> instance, in parse_menu_item (in keyboard.c) to avoid the >> similar problem for the future? > Sounds like a costly alternative, constantly allocating new strings. What I thought was to change the slot of the string to the copied one if the string is read-only (as the attached code). Then it seems that the count of copying is the same as the case that we call copy-sequence in menu-bar-update-buffers. But, as I'm not familiar with the code around parse_menu_item, I may be wrong. --- Ken'ichi HANDA handa@m17n.org *** keyboard.c 19 Apr 2004 08:43:56 +0900 1.770 --- keyboard.c 20 Apr 2004 08:08:53 +0900 *************** *** 7150,7155 **** --- 7150,7160 ---- AREF (item_properties, ITEM_PROPERTY_ITEM) = item; item_string = XCAR (item); + if (STRINGP (item_string) && PURE_P (item_string)) + { + item_string = Fcopy_sequence (item_string); + XSETCAR (item, item_string); + } start = item; item = XCDR (item);