all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dan Nicolaescu <dann@ics.uci.edu>
Cc: emacs-devel@gnu.org
Subject: Re: make a pure string from a string literal
Date: Wed, 04 Nov 2009 15:40:47 -0500	[thread overview]
Message-ID: <jwveioe58is.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <200911041601.nA4G1Ijj003807@godzilla.ics.uci.edu> (Dan Nicolaescu's message of "Wed, 4 Nov 2009 08:01:18 -0800 (PST)")

> 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.


        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.  */




  parent reply	other threads:[~2009-11-04 20:40 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 [this message]
2009-11-04 21:20   ` Dan Nicolaescu

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

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

  git send-email \
    --in-reply-to=jwveioe58is.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.