emacs-devel
[Top][All Lists]
Advanced

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

Re: Pure strings (Re: Compilation to native)


From: Kenichi Handa
Subject: Re: Pure strings (Re: Compilation to native)
Date: Tue, 20 Apr 2004 08:39:41 +0900 (JST)
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)

In article <address@hidden>, Stefan Monnier <address@hidden> 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
address@hidden

*** 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);




reply via email to

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