Skip to content
Snippets Groups Projects
Commit 82ac1886 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

minor fix

Rev: src/dynamic_buffer.c:1.3
parent b30104cc
No related branches found
No related tags found
No related merge requests found
...@@ -76,11 +76,15 @@ void low_init_buf_with_string(string s,dynamic_buffer *buf) ...@@ -76,11 +76,15 @@ void low_init_buf_with_string(string s,dynamic_buffer *buf)
{ {
if(buf->s.str) { free(buf->s.str); buf->s.str=NULL; } if(buf->s.str) { free(buf->s.str); buf->s.str=NULL; }
buf->s=s; buf->s=s;
if(!buf->s.str) init_buf(); if(!buf->s.str) initialize_buf(buf);
/* if the string is an old buffer, this realloc will set the old /* if the string is an old buffer, this realloc will set the old
the bufsize back */ the bufsize back */
for(buf->bufsize=BUFFER_BEGIN_SIZE;buf->bufsize<buf->s.len;buf->bufsize*=2); for(buf->bufsize=BUFFER_BEGIN_SIZE;buf->bufsize<buf->s.len;buf->bufsize*=2);
buf->s.str=realloc(buf->s.str,buf->bufsize); buf->s.str=realloc(buf->s.str,buf->bufsize);
#ifdef DEBUG
if(!buf->s.str)
fatal("Realloc failed.\n");
#endif
} }
string complex_free_buf(void) string complex_free_buf(void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment