Branch: Tag:

2009-01-06

2009-01-06 10:04:24 by Stephen R. van den Berg <srb@cuci.nl>

Simplify string_builder_init.

Rev: src/stralloc.c:1.234

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.233 2008/11/05 15:03:39 grubba Exp $ + || $Id: stralloc.c,v 1.234 2009/01/06 10:04:24 srb Exp $   */      #include "global.h"
2233:    return next;   }    - PMOD_EXPORT void init_string_builder(struct string_builder *s, int mag) + PMOD_EXPORT void init_string_builder_alloc(struct string_builder *s, ptrdiff_t length, int mag)   { -  s->malloced=256; -  s->s=begin_wide_shared_string(256,mag); +  s->s=begin_wide_shared_string(length,mag); +  s->malloced=length; +  s->known_shift=0;    s->s->len=0;    low_set_index (s->s, 0, 0); -  s->known_shift=0; +    }    - PMOD_EXPORT void init_string_builder_alloc(struct string_builder *s, ptrdiff_t length, int mag) + PMOD_EXPORT void init_string_builder(struct string_builder *s, int mag)   { -  s->malloced=length; -  s->s=begin_wide_shared_string(length,mag); -  s->s->len=0; -  low_set_index (s->s, 0, 0); -  s->known_shift=0; +  init_string_builder_alloc(s, 256, mag);   }      PMOD_EXPORT void init_string_builder_copy(struct string_builder *to,