emacs-devel
[Top][All Lists]
Advanced

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

Re: Compiling Elisp to a native code with a GCC plugin


From: Lars Magne Ingebrigtsen
Subject: Re: Compiling Elisp to a native code with a GCC plugin
Date: Fri, 17 Sep 2010 16:18:30 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> Fbuffer_substring also likely copies the multibyteness, not just the
> bytes.

Yes, probably, but I don't know what that means.

The code, in more fullness, is:

  if (start < GPT && GPT < end)
    move_gap (start);

  if (! NILP (current_buffer->enable_multibyte_characters))
    result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
  else
    result = make_uninit_string (end - start);
  memcpy (SDATA (result), BYTE_POS_ADDR (start_byte), end_byte - start_byte);

So no matter whether it creates a "multibyte string" or not (and I don't
know what the difference is), it still just does a memcpy from the
buffer representation over to the string representation.

But I've now read "33.1 Text Representations", and I think I understand
a bit better.  If you have a unibyte string with the bytes

#x68 #xe9 #x6c #x6c #x6f

in it, and you have a multibyte buffer with the string

héllo

in it, then they won't match.  But are they supposed to?

(equal (unibyte-string #x68 #xe9 #x6c #x6c #x6f) "héllo")
=> nil

I guess not.

So I'm thinking the memcmp() is sufficient to give the desired result.
Isn't it?

-- 
(domestic pets only, the antidote for overdose, milk.)
  address@hidden * Lars Magne Ingebrigtsen




reply via email to

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