leafnode  1.12.0
About: Leafnode is a store & forward NNTP proxy for small (dialup) sites.
  Fossies Dox: leafnode-1.12.0.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

mastring.h
Go to the documentation of this file.
1/* mastring.h -- Implement auto-allocating string functions.
2 *
3 * (C) 2001 - 2006 by Matthias Andree <matthias.andree@gmx.de>
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2 or 2.1 of
8 * the License. See the file COPYING.LGPL for details.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 */
20#ifndef MASTRING_H
21#define MASTRING_H
22
23#include "version.h"
24
25#include <sys/types.h> /* for size_t */
26#include <stdio.h>
27
28struct mastr {
32};
33
34typedef struct mastr mastr;
35
36#define MASTR_OOM_ABORT 1
37
38/*@only@*/ mastr *mastr_new(size_t);
39/*@only@*/ mastr *mastr_newstr(const char *);
40int mastr_cpy(mastr *, const char *);
41int mastr_cat(mastr *, /*@unique@*/ /*@observer@*/ const char *const);
42int mastr_vcat(mastr *, ...);
43int mastr_resizekeep(mastr *, size_t);
44int mastr_resizekill(mastr *, size_t);
45size_t mastr_size(mastr *);
46#if LEAFNODE_VERSION > 1
47ssize_t mastr_getln(mastr *, FILE *, ssize_t maxbytes);
48#endif
49#define mastr_autosize(m) do { (void)mastr_resizekeep(m, m->len); } while(0)
50void mastr_delete(/*@only@*/ mastr *);
51void mastr_clear(mastr *);
52void mastr_triml(mastr * m);
53void mastr_trimr(mastr * m);
54void mastr_chop(mastr * m);
55size_t mastr_len(mastr *);
56#define mastr_trim(m) do { mastr_triml(m); mastr_trimr(m); } while(0)
57#define mastr_str(m) ((const char *)(m->PRIVATE__dat))
58#define mastr_modifyable_str(m) (m->PRIVATE__dat)
59#endif
unsigned long maxbytes
Definition: configutil.c:72
mastr * mastr_new(size_t)
Definition: mastring.c:62
void mastr_trimr(mastr *m)
Definition: mastring.c:249
void mastr_clear(mastr *)
Definition: mastring.c:138
void mastr_triml(mastr *m)
Definition: mastring.c:232
size_t mastr_len(mastr *)
Definition: mastring.c:328
int mastr_vcat(mastr *,...)
Definition: mastring.c:147
size_t mastr_size(mastr *)
Definition: mastring.c:321
int mastr_resizekill(mastr *, size_t)
Definition: mastring.c:182
int mastr_resizekeep(mastr *, size_t)
Definition: mastring.c:202
void mastr_delete(mastr *)
Definition: mastring.c:223
int mastr_cpy(mastr *, const char *)
Definition: mastring.c:102
int mastr_cat(mastr *, const char *const)
Definition: mastring.c:120
mastr * mastr_newstr(const char *)
Definition: mastring.c:86
void mastr_chop(mastr *m)
Definition: mastring.c:311
Definition: mastring.h:28
char * PRIVATE__dat
Definition: mastring.h:29
size_t PRIVATE__bufsize
Definition: mastring.h:30
size_t PRIVATE__len
Definition: mastring.h:31