You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
387 B
23 lines
387 B
#define _POSIX_C_SOURCE 200809l
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "fstr.h"
|
|
#include "config.h"
|
|
|
|
void fstr_add_space(fstr_t *fs)
|
|
{
|
|
erealloc(fs->s, fs->len + fs->space + DEF_CHUNKSIZE + 1);
|
|
fs->space += DEF_CHUNKSIZE;
|
|
}
|
|
|
|
void fstr_append_char(fstr_t *fs, char c)
|
|
{
|
|
if (!fs)
|
|
return;
|
|
if (fs->space < 1)
|
|
fstr_add_space(fs);
|
|
fs->s[fs->len++] = c;
|
|
fs->s[fs->len] = '\0';
|
|
fs->space--;
|
|
}
|
|
|