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.189 2004/11/11 14:57:11 grubba Exp $ + || $Id: stralloc.c,v 1.190 2004/11/11 16:01:05 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"   #include "stuff.h"   #include "bignum.h"   #include "interpret.h"   #include "block_alloc.h"   #include "operators.h"   #include "pike_float.h" -  + #include "port.h"      #include <errno.h>   #include <float.h>   #include <ctype.h>   #include <math.h>      /* #define STRALLOC_USE_PRIMES */      #ifdef STRALLOC_USE_PRIMES   
pike.git/src/stralloc.c:2396:       case 'w': /* Same as l, but old-style, and only for %s. */    case 'l':    if (flags & APPEND_WIDTH_LONG) {    flags |= APPEND_WIDTH_LONG_LONG;    } else {    flags |= APPEND_WIDTH_LONG;    }    continue;    +  case 't': /* ptrdiff_t */ +  case 'z': /* size_t */ +  flags = (flags & ~APPEND_WIDTH_MASK) | APPEND_WIDTH_PTR; +  continue; +     case 'O':    {    /* FIXME: Doesn't care about field or integer 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:2536:    if (val+val == val) {    if (val > 0.0) {    /* Infinity */    string_builder_strcat(s, "inf");    } else {    string_builder_strcat(s, "0.0");    }    break;    }    /* FIXME: Field lengths and precision. */ -  if ((bytes = snprintf(NULL, 0, "%f", val))) { +  if ((bytes = SNPRINTF(NULL, 0, "%f", val))) {    p_wchar0 *p = string_builder_allocate(s, bytes, 0); -  size_t check = snprintf(p, bytes+1, "%f", val); +  size_t check = SNPRINTF(p, bytes+1, "%f", val);    if (check != bytes) {    Pike_fatal("string_builder_vsprintf(): snprintf(%f) is not "    "trustworthy: %"PRINTSIZET"u != %"PRINTSIZET"u\n",    val, bytes, check);    }    if (s->s->size_shift) {    /* We need to widen the string we just wrote. */    if (s->s->size_shift == 1) {    p_wchar1 *p1 = (p_wchar1 *)p;    while (bytes--) {