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.c File Reference
#include "config.h"
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include "wantassert.h"
#include <assert.h>
#include "mastring.h"
#include "getline.h"
Include dependency graph for mastring.c:

Go to the source code of this file.

Macros

#define len   PRIVATE__len
 
#define dat   PRIVATE__dat
 
#define bufsize   PRIVATE__bufsize
 
#define min(a, b)   ((a < b) ? (a) : (b))
 

Functions

static void mastr_oom (void)
 
mastrmastr_new (size_t size)
 
mastrmastr_newstr (const char *s)
 
int mastr_cpy (mastr *m, const char *s)
 
int mastr_cat (mastr *m, const char *const s)
 
void mastr_clear (mastr *m)
 
int mastr_vcat (mastr *m,...)
 
int mastr_resizekill (mastr *m, size_t l)
 
int mastr_resizekeep (mastr *m, size_t l)
 
void mastr_delete (mastr *m)
 
void mastr_triml (mastr *m)
 
void mastr_trimr (mastr *m)
 
static void choplast (mastr *m)
 
void mastr_chop (mastr *m)
 
size_t mastr_size (mastr *m)
 
size_t mastr_len (mastr *m)
 

Macro Definition Documentation

◆ bufsize

#define bufsize   PRIVATE__bufsize

Definition at line 33 of file mastring.c.

◆ dat

#define dat   PRIVATE__dat

Definition at line 32 of file mastring.c.

◆ len

#define len   PRIVATE__len

Definition at line 31 of file mastring.c.

◆ min

#define min (   a,
 
)    ((a < b) ? (a) : (b))

Definition at line 59 of file mastring.c.

Function Documentation

◆ choplast()

static void choplast ( mastr m)
static

Definition at line 301 of file mastring.c.

Referenced by mastr_chop().

◆ mastr_cat()

int mastr_cat ( mastr m,
const char *const  s 
)

Definition at line 120 of file mastring.c.

References mastr_oom(), and mastr_resizekeep().

◆ mastr_chop()

void mastr_chop ( mastr m)

chop off trailing LF or CRLF

Definition at line 311 of file mastring.c.

References choplast().

◆ mastr_clear()

void mastr_clear ( mastr m)

Definition at line 138 of file mastring.c.

Referenced by cleanmids(), and createmsgiddir().

◆ mastr_cpy()

int mastr_cpy ( mastr m,
const char *  s 
)

Definition at line 102 of file mastring.c.

References mastr_oom(), and mastr_resizekill().

Referenced by fopenpseudoart(), getgroup(), and myscandir().

◆ mastr_delete()

◆ mastr_len()

size_t mastr_len ( mastr m)

return length of buffer

Definition at line 328 of file mastring.c.

Referenced by chdirgroup().

◆ mastr_new()

◆ mastr_newstr()

mastr * mastr_newstr ( const char *  s)

Definition at line 86 of file mastring.c.

References mastr_new().

◆ mastr_oom()

static void mastr_oom ( void  )
inlinestatic

◆ mastr_resizekeep()

int mastr_resizekeep ( mastr m,
size_t  l 
)

Definition at line 202 of file mastring.c.

References len, and mastr_oom().

Referenced by mastr_cat(), and mastr_vcat().

◆ mastr_resizekill()

int mastr_resizekill ( mastr m,
size_t  l 
)

Definition at line 182 of file mastring.c.

References mastr_oom().

Referenced by checkpeerlocal(), and mastr_cpy().

◆ mastr_size()

size_t mastr_size ( mastr m)

return size of buffer

Definition at line 321 of file mastring.c.

Referenced by checkpeerlocal().

◆ mastr_triml()

void mastr_triml ( mastr m)

Definition at line 232 of file mastring.c.

◆ mastr_trimr()

void mastr_trimr ( mastr m)

Definition at line 249 of file mastring.c.

◆ mastr_vcat()

int mastr_vcat ( mastr m,
  ... 
)