emacs-devel
[Top][All Lists]
Advanced

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

Re: space leak from `values'


From: Kim F. Storm
Subject: Re: space leak from `values'
Date: 29 Jul 2004 14:00:17 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Miles Bader <address@hidden> writes:

> address@hidden (Kim F. Storm) writes:
> >> What's wrong with (setcdr (nthcdr (1- N) LIST) VALUE) ?
> >
> > Read the third line of the doc string:
> >
> >> If list has less than N elements, do not modify list.
> >
> > Your suggestion fails if N is less than the length of the list:
> 
> It's trivial to handle though that -- just see if the result of `nthcdr'
> is nil, and only do the `setcdr' if not.  Adding a C function for this
> rather rare operation just seems kinda like pointless bloat...

Rare ?  Pointless ?

Truncating a list to a specific maximum is quite common if you ask me.

ido.el:    (if (> (length ido-work-directory-list) ido-max-work-directory-list)
ido.el:    (if (> (length ido-work-file-list) ido-max-work-file-list)
ido.el:   (if (> (length ido-dir-file-cache) ido-max-dir-file-cache)
isearch.el:         (if (> (length regexp-search-ring) regexp-search-ring-max)
isearch.el:       (if (> (length search-ring) search-ring-max)
menu-bar.el:  (if (> (length (cdr yank-menu)) kill-ring-max)
menu-bar.el:         (if (> (length buffers) buffers-menu-max-size)
simple.el:    (if (> (length kill-ring) kill-ring-max)
calc/calc-aent.el:      (when (> (length kill-ring) kill-ring-max)
calendar/calendar.el:          (if (> (length calendar-mark-ring) (1+ 
mark-ring-max))
emulation/cua-rect.el:    (if (> (length cua--undo-list) cua-undo-max)
emulation/viper-cmd.el:  (if (> (length kill-ring) kill-ring-max)
net/eudc.el:         (> (length servers) eudc-max-servers-to-query))
progmodes/ada-xref.el:  (if (> (length ada-xref-pos-ring) ada-xref-pos-ring-max)
progmodes/xscheme.el:  (if (> (length xscheme-expressions-ring) 
xscheme-expressions-ring-max)
textmodes/bibtex.el:      (if (> (length bibtex-field-kill-ring) 
bibtex-field-kill-ring-max)
textmodes/bibtex.el:      (if (> (length bibtex-entry-kill-ring) 
bibtex-entry-kill-ring-max)

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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