pike.git/
src/
stralloc.c
Branch:
Tag:
Non-build tags
All tags
No tags
2003-04-07
2003-04-07 15:28:47 by Martin Stjernholm <mast@lysator.liu.se>
8d3b3881edeeea88bca071028b5408f9a0e4a903 (
14
lines) (+
12
/-
2
)
[
Show
|
Annotate
]
Branch:
7.9
Added init_string_builder_copy.
Rev: src/stralloc.c:1.155
Rev: src/stralloc.h:1.74
2:
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: stralloc.c,v 1.
154
2003/
03
/
17
16
:
44
:
23
grubba
Exp $
+
|| $Id: stralloc.c,v 1.
155
2003/
04
/
07
15
:
28
:
47
mast
Exp $
*/ #include "global.h"
24:
#include <ctype.h> #include <math.h>
-
RCSID("$Id: stralloc.c,v 1.
154
2003/
03
/
17
16
:
44
:
23
grubba
Exp $");
+
RCSID("$Id: stralloc.c,v 1.
155
2003/
04
/
07
15
:
28
:
47
mast
Exp $");
/* #define STRALLOC_USE_PRIMES */
1963:
s->known_shift=0; }
+
PMOD_EXPORT void init_string_builder_copy(struct string_builder *to,
+
struct string_builder *from)
+
{
+
to->malloced = from->malloced;
+
to->s = begin_wide_shared_string (from->s->len, from->s->size_shift);
+
MEMCPY (to->s->str, from->s->str, from->s->len << from->s->size_shift);
+
to->known_shift = from->known_shift;
+
}
+
static void string_build_mkspace(struct string_builder *s, ptrdiff_t chars, int mag) {