X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fbuffer.h;h=ba6647ed0c095119247617e714fdb01b090266b9;hp=73c1f69e407493112f8a445dc2802d20782638be;hb=963c5055505f2fc117cd5efa06eaa02c9b2bf85d;hpb=8de8f1d9e2c2c02d4a14a5506e7d0d914dc328da diff --git a/src/buffer.h b/src/buffer.h index 73c1f69e..ba6647ed 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1,18 +1,37 @@ -#ifndef __TINC_BUFFER_H__ -#define __TINC_BUFFER_H__ +#ifndef MESHLINK_BUFFER_H +#define MESHLINK_BUFFER_H + +/* + conf.h -- header for conf.c + Copyright (C) 2014, 2017 Guus Sliepen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ typedef struct buffer_t { char *data; - int maxlen; - int len; - int offset; + size_t maxlen; + size_t len; + size_t offset; } buffer_t; -extern void buffer_compact(buffer_t *buffer); -extern char *buffer_prepare(buffer_t *buffer, int size); -extern void buffer_add(buffer_t *buffer, const char *data, int size); +extern void buffer_compact(buffer_t *buffer, size_t maxsize); +extern char *buffer_prepare(buffer_t *buffer, size_t size); +extern void buffer_add(buffer_t *buffer, const char *data, size_t size); extern char *buffer_readline(buffer_t *buffer); -extern char *buffer_read(buffer_t *buffer, int size); +extern char *buffer_read(buffer_t *buffer, size_t size); extern void buffer_clear(buffer_t *buffer); #endif