[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make a pure string from a string literal
From: |
Stefan Monnier |
Subject: |
Re: make a pure string from a string literal |
Date: |
Wed, 04 Nov 2009 15:40:47 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
> 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. */