// class cl_spushstring.

// General includes.
#include "cl_sysdep.h"

// Specification.
#include "cl_spushstring.h"


// Implementation.

#include <cstring> // declares memcpy()

namespace cln {

void cl_spushstring::push (char c)
{
	if (index >= alloc) {
		var uintL newalloc = 2*alloc;
		var char* newbuffer = (char *) malloc_hook(newalloc);
		memcpy(newbuffer,buffer,alloc);
		free_hook(buffer);
		buffer = newbuffer;
		alloc = newalloc;
	}
	// Now index < alloc.
	buffer[index++] = c;
}

}  // namespace cln


syntax highlighted by Code2HTML, v. 0.9.1