1
0
mirror of https://github.com/GOSTSec/ccminer synced 2025-01-09 06:18:07 +00:00
ccminer/compat/jansson/strbuffer.h

34 lines
954 B
C
Raw Normal View History

2014-03-18 21:17:40 +00:00
/*
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
2014-03-18 21:17:40 +00:00
*
* Jansson is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef STRBUFFER_H
#define STRBUFFER_H
typedef struct {
char *value;
size_t length; /* bytes used */
size_t size; /* bytes allocated */
2014-03-18 21:17:40 +00:00
} strbuffer_t;
int strbuffer_init(strbuffer_t *strbuff);
void strbuffer_close(strbuffer_t *strbuff);
void strbuffer_clear(strbuffer_t *strbuff);
const char *strbuffer_value(const strbuffer_t *strbuff);
/* Steal the value and close the strbuffer */
2014-03-18 21:17:40 +00:00
char *strbuffer_steal_value(strbuffer_t *strbuff);
int strbuffer_append(strbuffer_t *strbuff, const char *string);
int strbuffer_append_byte(strbuffer_t *strbuff, char byte);
int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size);
2014-03-18 21:17:40 +00:00
char strbuffer_pop(strbuffer_t *strbuff);
#endif