Libical  2.0
icalmemory.h
1 /*======================================================================
2  FILE: icalmemory.h
3  CREATOR: eric 30 June 1999
4 
5  (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org>
6  http://www.softwarestudio.org
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of either:
10 
11  The LGPL as published by the Free Software Foundation, version
12  2.1, available at: http://www.gnu.org/licenses/lgpl-2.1.html
13 
14  Or:
15 
16  The Mozilla Public License Version 1.0. You may obtain a copy of
17  the License at http://www.mozilla.org/MPL/
18 
19  The Initial Developer of the Original Code is Eric Busboom
20 ======================================================================*/
21 
22 #ifndef ICALMEMORY_H
23 #define ICALMEMORY_H
24 
25 /* Tmp buffers are managed by ical. References can be returned to the
26  caller, although the caller will not own the memory. */
27 
28 #include "libical_ical_export.h"
29 
30 LIBICAL_ICAL_EXPORT void *icalmemory_tmp_buffer(size_t size);
31 LIBICAL_ICAL_EXPORT char *icalmemory_tmp_copy(const char *str);
32 
34 LIBICAL_ICAL_EXPORT void icalmemory_add_tmp_buffer(void *);
35 
37 LIBICAL_ICAL_EXPORT void icalmemory_free_ring(void);
38 
39 /* Non-tmp buffers must be freed. These are mostly wrappers around
40  * malloc, etc, but are used so the caller can change the memory
41  * allocators in a future version of the library */
42 
43 LIBICAL_ICAL_EXPORT void *icalmemory_new_buffer(size_t size);
44 LIBICAL_ICAL_EXPORT void *icalmemory_resize_buffer(void *buf, size_t size);
45 LIBICAL_ICAL_EXPORT void icalmemory_free_buffer(void *buf);
46 
54 /* THESE ROUTINES CAN NOT BE USED ON TMP BUFFERS. Only use them on
55  normally allocated memory, or on buffers created from
56  icalmemory_new_buffer, never with buffers created by
57  icalmemory_tmp_buffer. If icalmemory_append_string has to resize a
58  buffer on the ring, the ring will loose track of it an you will
59  have memory problems. */
60 
61 LIBICAL_ICAL_EXPORT void icalmemory_append_string(char **buf, char **pos, size_t *buf_size,
62  const char *string);
63 
65 LIBICAL_ICAL_EXPORT void icalmemory_append_char(char **buf, char **pos, size_t *buf_size, char ch);
66 
69 LIBICAL_ICAL_EXPORT char *icalmemory_strdup(const char *s);
70 
71 #endif /* !ICALMEMORY_H */
void icalmemory_free_ring()
Definition: icalmemory.c:214
void * icalmemory_tmp_buffer(size_t size)
Definition: icalmemory.c:192
char * icalmemory_strdup(const char *s)
Definition: icalmemory.c:238
void icalmemory_append_char(char **buf, char **pos, size_t *buf_size, char ch)
Definition: icalmemory.c:317
void icalmemory_append_string(char **buf, char **pos, size_t *buf_size, const char *string)
Definition: icalmemory.c:279
char * icalmemory_tmp_copy(const char *str)
Definition: icalmemory.c:229
void icalmemory_add_tmp_buffer(void *buf)
Definition: icalmemory.c:169