]> git.proxmox.com Git - libgit2.git/blame - src/buffer.h
Merge pull request #444 from carlosmn/fetch-fixes
[libgit2.git] / src / buffer.h
CommitLineData
bb742ede
VM
1/*
2 * Copyright (C) 2009-2011 the libgit2 contributors
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
afeecf4f
VM
7#ifndef INCLUDE_buffer_h__
8#define INCLUDE_buffer_h__
9
10#include "common.h"
11
12typedef struct {
13 char *ptr;
14 ssize_t asize, size;
15} git_buf;
16
17#define GIT_BUF_INIT {NULL, 0, 0}
18
19int git_buf_grow(git_buf *buf, size_t target_size);
20int git_buf_oom(const git_buf *buf);
21void git_buf_putc(git_buf *buf, char c);
22void git_buf_put(git_buf *buf, const char *data, size_t len);
23void git_buf_puts(git_buf *buf, const char *string);
24void git_buf_printf(git_buf *buf, const char *format, ...) GIT_FORMAT_PRINTF(2, 3);
25const char *git_buf_cstr(git_buf *buf);
26void git_buf_free(git_buf *buf);
b87600cb 27void git_buf_clear(git_buf *buf);
c7c30513 28void git_buf_consume(git_buf *buf, const char *end);
afeecf4f
VM
29
30#define git_buf_PUTS(buf, str) git_buf_put(buf, str, sizeof(str) - 1)
31
32#endif