1 // class cl_spushstring.
7 #include "cl_spushstring.h"
12 #include <string.h> // declares memcpy()
14 void cl_spushstring::append (const char * ptr, uintL len)
16 if (index + len > alloc) {
17 var uintL newalloc = index+2*len;
18 if (newalloc < 2*alloc) { newalloc = 2*alloc; }
19 var char* newbuffer = (char *) cl_malloc_hook(newalloc);
20 memcpy(newbuffer,buffer,alloc);
25 // Now index+len <= alloc.
26 for (uintL count = len; count > 0; count--)
27 buffer[index++] = *ptr++;