39 #define PREFIX_CUSHION 8 81 char *new_buf = (
char *) malloc (
sizeof (
char) * (size + n));
92 memcpy (new_buf, vstr->
base, size);
96 vstr->
limit = new_buf + size + n;
97 vstr->
start = new_buf + offset;
102 char *new_buf = (
char *) malloc (
sizeof (
char) * n);
109 vstr->
base = new_buf;
110 vstr->
limit = new_buf + n;
142 for (p = vstr->
end, limit = vstr->
limit; p < limit;)
155 if (
vs_strcat (vstr, va_arg (args,
char *)))
163 if (
vs_itoa (vstr, va_arg (args,
int)))
207 sprintf (buf,
"%d", n);
323 n = (int)
strlen (prefix);
354 memmove (new_start, vstr->
start, length);
356 vstr->
end = new_start + length;
357 vstr->
start = new_start;
362 memcpy (vstr->
start, prefix, n);
386 va_start (args, fmt);
409 if (str ==
NULL || (n = (
int)
strlen (str)) == 0)
419 memcpy (vstr->
end, str, n);
442 if (str ==
NULL || length == 0)
452 memcpy (vstr->
end, str, length);
490 *vstr->
end++ = (char) ch;
static int vs_grow(varstring *vstr, int n)
int vs_append(varstring *vstr, const char *suffix)
varstring * vs_new(varstring *vstr)
int vs_prepend(varstring *vstr, const char *prefix)
int vs_strcpy(varstring *vstr, const char *str)
int vs_sprintf(varstring *vstr, const char *fmt,...)
char * vs_str(varstring *vstr)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
static int vs_itoa(varstring *vstr, int n)
void vs_free(varstring *vstr)
#define ER_OUT_OF_VIRTUAL_MEMORY
static int vs_do_sprintf(varstring *vstr, const char *fmt, va_list args)
int vs_strcatn(varstring *vstr, const char *str, int length)
int vs_putc(varstring *vstr, int ch)
void vs_clear(varstring *vstr)
int vs_strcat(varstring *vstr, const char *str)
int vs_strlen(const varstring *vstr)
static const char * EMPTY_STRING
static int vs_cannot_hold(varstring *vstr, int n)