PageRenderTime 61ms CodeModel.GetById 53ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/jansson/src/strbuffer.h

http://github.com/nicolasff/webdis
C++ Header | 31 lines | 17 code | 8 blank | 6 comment | 0 complexity | ac7665b7e77aa8323f13dd077953da3d MD5 | raw file
 1/*
 2 * Copyright (c) 2009, 2010 Petri Lehtinen <petri@digip.org>
 3 *
 4 * Jansson is free software; you can redistribute it and/or modify
 5 * it under the terms of the MIT license. See LICENSE for details.
 6 */
 7
 8#ifndef STRBUFFER_H
 9#define STRBUFFER_H
10
11typedef struct {
12    char *value;
13    int length;   /* bytes used */
14    int size;     /* bytes allocated */
15} strbuffer_t;
16
17int strbuffer_init(strbuffer_t *strbuff);
18void strbuffer_close(strbuffer_t *strbuff);
19
20void strbuffer_clear(strbuffer_t *strbuff);
21
22const char *strbuffer_value(const strbuffer_t *strbuff);
23char *strbuffer_steal_value(strbuffer_t *strbuff);
24
25int strbuffer_append(strbuffer_t *strbuff, const char *string);
26int strbuffer_append_byte(strbuffer_t *strbuff, char byte);
27int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, int size);
28
29char strbuffer_pop(strbuffer_t *strbuff);
30
31#endif