pike.git / src / dynamic_buffer.c

version» Context lines:

pike.git/src/dynamic_buffer.c:3:   ||| Pike is distributed under GPL, LGPL and MPL. See the file COPYING   ||| for more information.   \*/   /**/   #include "global.h"   #include "dynamic_buffer.h"   #include "stralloc.h"   #include "pike_error.h"   #include "pike_memory.h"    - RCSID("$Id: dynamic_buffer.c,v 1.15 2002/05/31 22:41:23 nilsson Exp $"); + RCSID("$Id: dynamic_buffer.c,v 1.16 2002/08/15 14:49:20 marcus Exp $");      static dynamic_buffer buff;      PMOD_EXPORT char *low_make_buf_space(size_t space, dynamic_buffer *buf)   {    char *ret;   #ifdef PIKE_DEBUG -  if(!buf->s.str) fatal("ARRRRGH! Deadly Trap!\n"); +  if(!buf->s.str) Pike_fatal("ARRRRGH! Deadly Trap!\n");   #endif       if(buf->s.len+space >= buf->bufsize)    {    if(!buf->bufsize) buf->bufsize=1;       do{    buf->bufsize*=2;    }while(buf->s.len+space >= buf->bufsize);   
pike.git/src/dynamic_buffer.c:35:    }    ret = buf->s.str + buf->s.len;    buf->s.len += space;    return ret;   }      PMOD_EXPORT void low_my_putchar(char b,dynamic_buffer *buf)   {   #ifdef PIKE_DEBUG    if(!buf->s.str) -  fatal("Error in internal buffering.\n"); +  Pike_fatal("Error in internal buffering.\n");   #endif    low_make_buf_space(1,buf)[0]=b;   }      PMOD_EXPORT void low_my_binary_strcat(const char *b, size_t l,    dynamic_buffer *buf)   {   #ifdef PIKE_DEBUG    if(!buf->s.str) -  fatal("Error in internal buffering.\n"); +  Pike_fatal("Error in internal buffering.\n");   #endif       MEMCPY(low_make_buf_space(l, buf),b, l);   }      PMOD_EXPORT void debug_initialize_buf(dynamic_buffer *buf)   {    buf->s.str=(char *)xalloc((buf->bufsize=BUFFER_BEGIN_SIZE));    *(buf->s.str)=0;    buf->s.len=0;
pike.git/src/dynamic_buffer.c:80:   {    if(buf->s.str) { free(buf->s.str); buf->s.str=NULL; }    buf->s=s;    if(!buf->s.str) initialize_buf(buf);    /* if the string is an old buffer, this realloc will set the old    the bufsize back */    for(buf->bufsize=BUFFER_BEGIN_SIZE;buf->bufsize<buf->s.len;buf->bufsize*=2);    buf->s.str=realloc(buf->s.str,buf->bufsize);   #ifdef PIKE_DEBUG    if(!buf->s.str) -  fatal("Realloc failed.\n"); +  Pike_fatal("Realloc failed.\n");   #endif   }      PMOD_EXPORT string complex_free_buf(void)   {    string tmp;    if(!buff.s.str) return buff.s;    my_putchar(0);    buff.s.len--;    tmp=buff.s;