unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: make a pure string from a string literal
Date: Wed, 4 Nov 2009 13:20:07 -0800 (PST)	[thread overview]
Message-ID: <200911042120.nA4LK7f9006754@godzilla.ics.uci.edu> (raw)
In-Reply-To: <jwveioe58is.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 04 Nov 2009 15:40:47 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

  > > So how about adding:
  > 
  > > Lisp_Object
  > > make_pure_string_from_literal (const char *data)
  > 
  > My local hacks include the hunk below, so I think it's a good idea, tho
  > I never got around to installing it.

Please do.
I'd be happy to install it for you (and make use of it).


  >         Stefan
  > 
  > 
  > @@ -4821,6 +4887,23 @@
  >    return string;
  >  }
  >  
  > +Lisp_Object
  > +make_pure_c_string (data)
  > +     const char *data;
  > +{
  > +  Lisp_Object string;
  > +  struct Lisp_String *s;
  > +  int nchars = strlen (data);
  > +
  > +  s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String);
  > +  s->inlined = 0;
  > +  s->size = nchars;
  > +  s->size_byte = -1;
  > +  s->data.ptr = data;
  > +  s->intervals = NULL_INTERVAL;
  > +  XSETSTRING (string, s);
  > +  return string;
  > +}
  >  
  >  /* Return a cons allocated from pure space.  Give it pure copies
  >     of CAR as car and CDR as cdr.  */




      reply	other threads:[~2009-11-04 21:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 16:01 make a pure string from a string literal Dan Nicolaescu
2009-11-04 18:41 ` Juanma Barranquero
2009-11-04 20:40 ` Stefan Monnier
2009-11-04 21:20   ` Dan Nicolaescu [this message]

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=200911042120.nA4LK7f9006754@godzilla.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --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).