Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
safeclib.h
Go to the documentation of this file.
1/*
2 SAFECLIB.h - Portable and safe wrappers around some clib functions and some tools
3
4 Copyright (C)
5 2008, Christian Thaeter <ct@pipapo.org>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11*/
12
13
19#include "error.h"
20
21#include <stdlib.h>
22
24
33void
35
36
43void*
44lumiera_malloc (size_t sz);
45
46
54void*
55lumiera_calloc (size_t n, size_t size);
56
57
64void*
65lumiera_realloc (void* ptr, size_t size);
66
67
72static inline void
73lumiera_free (void* mem)
74{
75 /* for now only a alias, might change in future */
76 free (mem);
77}
78
79
87char*
88lumiera_strndup (const char* str, size_t len);
89
90
99int
100lumiera_strncmp (const char* a, const char* b, size_t len);
101
102
109int
110lumiera_streq (const char* a, const char* b);
111
112/*
113// Local Variables:
114// mode: C
115// c-file-style: "gnu"
116// indent-tabs-mode: nil
117// End:
118*/
Lumiera error handling (C interface).
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition error.h:62
void * lumiera_calloc(size_t n, size_t size)
Allocate cleared memory for an array.
Definition safeclib.c:130
int lumiera_streq(const char *a, const char *b)
check 2 strings for identity.
Definition safeclib.c:191
int lumiera_strncmp(const char *a, const char *b, size_t len)
Compare two C strings.
Definition safeclib.c:184
char * lumiera_strndup(const char *str, size_t len)
Duplicate a C string.
Definition safeclib.c:166
static void lumiera_free(void *mem)
Free previously allocated memory.
Definition safeclib.h:73
void * lumiera_realloc(void *ptr, size_t size)
Change the size of a memory block.
Definition safeclib.c:149
void * lumiera_malloc(size_t sz)
Allocate memory.
Definition safeclib.c:113
void lumiera_safeclib_set_resourcecollector(void *hook)
Install the resourcecollector run hook.