unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: Dave Love <d.love@dl.ac.uk>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: space leak from `values'
Date: 29 Jul 2004 14:00:17 +0200	[thread overview]
Message-ID: <m3u0vrc9bi.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <buo3c3bgp24.fsf@mctpc71.ucom.lsi.nec.co.jp>

Miles Bader <miles@lsi.nec.co.jp> writes:

> storm@cua.dk (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 <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2004-07-29 12:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <rzqzn5qehby.fsf@albion.dl.ac.uk>
     [not found] ` <E1BoSQg-0001Br-II@fencepost.gnu.org>
     [not found]   ` <rzq3c3eex5r.fsf@albion.dl.ac.uk>
     [not found]     ` <E1Bp9wv-0004v0-Ts@fencepost.gnu.org>
     [not found]       ` <rzqllh4m4yi.fsf@albion.dl.ac.uk>
     [not found]         ` <jwvu0vs9gjz.fsf-monnier+emacs@gnu.org>
2004-07-28 23:13           ` space leak from `values' Kim F. Storm
2004-07-29  7:50             ` Miles Bader
2004-07-29  8:41               ` Kim F. Storm
2004-07-29  8:50                 ` David Kastrup
2004-07-29  9:06                 ` Miles Bader
2004-07-29 12:00                   ` Kim F. Storm [this message]
2004-07-30 16:16                     ` Richard Stallman
2004-08-20 12:51                       ` Kim F. Storm
2004-08-21 16:49                         ` Richard Stallman
2004-07-30  4:54                 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3u0vrc9bi.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=d.love@dl.ac.uk \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).