Esempio n. 1
0
strbuffer_t * json_token_tostr(char *js, jsmntok_t *t)
{
	if(t->start > strlen(js)
			|| t->end > strlen(js)
			|| t->end > strlen(js)
			|| (t->end - t->start) > strlen(js)
	) {
		return NULL;
	}

	strbuffer_t *string = (strbuffer_t *) json_malloc(sizeof(strbuffer_t));
	strbuffer_init(string);

	strbuffer_append_bytes(string, js + t->start, (t->end - t->start) );

	return string;
}
Esempio n. 2
0
static int dump_to_strbuffer(const char *buffer, size_t size, void *data)
{
    return strbuffer_append_bytes((strbuffer_t *)data, buffer, size);
}
Esempio n. 3
0
int strbuffer_append_byte(strbuffer_t *strbuff, char byte)
{
    return strbuffer_append_bytes(strbuff, &byte, 1);
}
Esempio n. 4
0
int strbuffer_append(strbuffer_t *strbuff, const char *string)
{
    return strbuffer_append_bytes(strbuff, string, strlen(string));
}