emacs-devel
[Top][All Lists]
Advanced

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

Re: make a pure string from a string literal


From: Dan Nicolaescu
Subject: Re: make a pure string from a string literal
Date: Wed, 4 Nov 2009 13:20:07 -0800 (PST)

Stefan Monnier <address@hidden> 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 via email to

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