pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:1:   /*   || 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.239 2010/06/15 16:10:19 grubba Exp $ + || $Id$   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "dynamic_buffer.h"   #include "pike_macros.h"   #include "pike_memory.h"   #include "pike_error.h"   #include "gc.h"
pike.git/src/stralloc.c:2326:    /* Ensure NUL-termination */    s->s->str[s->s->len << s->s->size_shift] = 0;   }      PMOD_EXPORT void string_builder_putchars(struct string_builder *s, int ch,    ptrdiff_t count)   {    ptrdiff_t len = s->s->len;    int mag = min_magnitude(ch);    +  // This is not really expected to happen. But since we are doing +  // memset here, a negative argument should be avoided. +  if (count < 0) Pike_fatal("Non-positive count in call to string_builder_putchars().\n"); +  if (!count) return; +     string_build_mkspace(s, count, mag);    if (mag > s->known_shift) {    s->known_shift = mag;    }       switch (s->s->size_shift) {    case 0:    MEMSET (STR0 (s->s) + s->s->len, ch, count);    break;    case 1: {