78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
*((char **)b) = blocks;
blocks = b;
p = b + PTRSIZE;
left = allocsize;
};
char *
pool::string(char *s, size_t l)
{
char *b = (char *)alloc(l + 1);
strncpy(b, s, l);
b[l] = 0;
return b;
};
pool *
gp() // useful for global buffers that need to be initialisation order
// independant
{
static pool *p = NULL;
return p ? p : (p = new pool());
|
|
<
>
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
*((char **)b) = blocks;
blocks = b;
p = b + PTRSIZE;
left = allocsize;
};
char *
pool::string(const char *s, size_t l)
{
char *b = (char *)alloc(l + 1);
strncpy(b, s, l);
b[l] = 0;
return b;
}
pool *
gp() // useful for global buffers that need to be initialisation order
// independant
{
static pool *p = NULL;
return p ? p : (p = new pool());
|