pike.git/
src/
builtin_functions.c
Branch:
Tag:
Non-build tags
All tags
No tags
1998-10-09
1998-10-09 22:28:35 by Henrik Grubbström (Grubba) <grubba@grubba.org>
1e45330e5268d4b142ce766dcfa37263bc175699 (
11
lines) (+
4
/-
7
)
[
Show
|
Annotate
]
Branch:
7.9
Improved implementation of unicode_to_string().
Rev: src/builtin_functions.c:1.124
4:
||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h"
-
RCSID("$Id: builtin_functions.c,v 1.
123
1998/10/09 22:
24
:
49
grubba Exp $");
+
RCSID("$Id: builtin_functions.c,v 1.
124
1998/10/09 22:
28
:
35
grubba Exp $");
#include "interpret.h" #include "svalue.h" #include "pike_macros.h"
727:
len = in->len / 2;
-
out = begin_shared_string(
in->
len
+
1);
-
out->size_shift = 1;
-
out->len = len;
+
out = begin_
wide_
shared_string(len
,
1);
#if (BYTEORDER == 4321) /* Big endian * * FIXME: Future optimization: Perform sufficient magic * to do the conversion in place if the ref-count is == 1. */
-
/* NOTE: We copy the zero-termination byte too */
-
MEMCPY(out->str, in->str, in->len
+ 1
);
+
MEMCPY(out->str, in->str, in->len);
#else /* Little endian */ { int i; p_wchar1 *str1 = STR1(out);
-
str1[len] = 0; /* Force proper zero termination */
+
for (i = len; i--;) { str1[i] = in->str[i*2]<<8 + in->str[i*2 + 1]; }