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.181 2004/11/06 15:39:33 grubba Exp $ + || $Id: stralloc.c,v 1.182 2004/11/06 17:25:12 grubba Exp $   */      #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:636: Inside #if undefined(HASH_PREFIX) and #if defined(PIKE_RUN_UNLOCKED)
   }   #ifdef PIKE_RUN_UNLOCKED    for(h=0;h<BUCKET_LOCKS;h++) mt_unlock(bucket_locks + h);   #endif    }   #endif   }      PMOD_EXPORT struct pike_string *debug_begin_wide_shared_string(size_t len, int shift)   { -  struct pike_string *t; +  struct pike_string *t = NULL;   #ifdef PIKE_DEBUG    extern int d_flag;    if(d_flag>10)    verify_shared_strings_tables();   #endif    if (len <= SHORT_STRING_THRESHOLD) {    if (!shift) {    t = (struct pike_string *)alloc_short_pike_string0();    } else if (shift == 1) {    t = (struct pike_string *)alloc_short_pike_string1();
pike.git/src/stralloc.c:2293:    if (len < min_width) {    /* Perform padding.    * Note that APPEND_ZERO_PAD can not be active here, since    * len is at least min_width in that case.    * Note that APPEND_LEFT is always active here, since    * min_width isn't zero.    */    string_builder_fill(s, min_width - len, MKPCHARP(" ", 0),    4, 0);    } + }    -  + PMOD_EXPORT void string_builder_append_integerv(struct string_builder *s, +  va_list args, +  unsigned int base, +  int flags, +  size_t min_width, +  size_t precision) + { +  LONGEST val = 0; +  switch (flags & (APPEND_WIDTH_MASK|APPEND_SIGNED)) { +  case APPEND_WIDTH_HALF: +  val = va_arg(args, unsigned int) & 0xffff; +  break; +  case APPEND_WIDTH_HALF|APPEND_SIGNED: +  val = (short)va_arg(args, int); +  break; +  case 0: +  val = va_arg(args, unsigned int); +  break; +  case APPEND_SIGNED: +  val = va_arg(args, int); +  break; +  case APPEND_WIDTH_LONG: +  val = va_arg(args, unsigned long); +  break; +  case APPEND_WIDTH_LONG|APPEND_SIGNED: +  val = va_arg(args, long); +  break; + #ifdef INT64 +  case APPEND_WIDTH_LONG_LONG: +  val = va_arg(args, unsigned INT64); +  break; +  case APPEND_WIDTH_LONG_LONG|APPEND_SIGNED: +  val = va_arg(args, INT64); +  break; + #endif /* INT64 */ +  default: +  Pike_fatal("string_builder_append_integerv(): Unsupported flags: 0x%04x\n", +  flags); +  break;    } -  +  string_builder_append_integer(s, val, base, flags, min_width, precision); + }      /* Values used internally in string_builder_vsprintf() */   #define STATE_MIN_WIDTH 1   #define STATE_PRECISION 2      PMOD_EXPORT void string_builder_vsprintf(struct string_builder *s,    const char *fmt,    va_list args)   {    while (*fmt) {
pike.git/src/stralloc.c:2345:    } else {    state = STATE_MIN_WIDTH;    min_width = min_width * 10 + fmt[-1] - '0';    }    continue;       case '.':    state = STATE_PRECISION;    continue;    +  case 'h': +  flags |= APPEND_WIDTH_HALF; +  continue; +  case 'l': +  if (flags & APPEND_WIDTH_LONG) { +  flags |= APPEND_WIDTH_LONG_LONG; +  } else { +  flags |= APPEND_WIDTH_LONG; +  } +  continue; +     case 'O':    {    /* FIXME: Doesn't care about field widths yet. */    dynamic_buffer old_buf;    init_buf(&old_buf);    describe_svalue(va_arg(args, struct svalue *), 0, NULL);    string_builder_binary_strcat(s, pike_global_buffer.s.str,    pike_global_buffer.s.len);    toss_buffer(&pike_global_buffer);    restore_buffer(&old_buf);
pike.git/src/stralloc.c:2399:    4, 0);    string_builder_binary_strcat(s, str, len);    }    } else {    string_builder_binary_strcat(s, str, len);    }    }    break;    case 'c':    /* FIXME: Doesn't case about field widths yet. */ -  string_builder_putchar(s, va_arg(args, INT32)); +  string_builder_putchar(s, va_arg(args, int));    break;    case 'b':    string_builder_append_integer(s, va_arg(args, unsigned int), 2,    flags, min_width, precision);    break;    case 'o':    string_builder_append_integer(s, va_arg(args, unsigned int), 8,    flags, min_width, precision);    break;    case 'x':