]> www.ginac.de Git - cln.git/blob - src/base/string/cl_spushstring_push.cc
* src/numtheory/cl_nt_sqrtmodp.cc: #undef _R.
[cln.git] / src / base / string / cl_spushstring_push.cc
1 // class cl_spushstring.
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_spushstring.h"
8
9
10 // Implementation.
11
12 #include <string.h> // declares memcpy()
13
14 namespace cln {
15
16 void cl_spushstring::push (char c)
17 {
18         if (index >= alloc) {
19                 var uintL newalloc = 2*alloc;
20                 var char* newbuffer = (char *) malloc_hook(newalloc);
21                 memcpy(newbuffer,buffer,alloc);
22                 free_hook(buffer);
23                 buffer = newbuffer;
24                 alloc = newalloc;
25         }
26         // Now index < alloc.
27         buffer[index++] = c;
28 }
29
30 }  // namespace cln