sensitise trayicon's 'get mail' and 'exit'
[claws.git] / src / plugins / vcalendar / libical / libical / icalmemory.h
1 /* -*- Mode: C -*- */
2 /*======================================================================
3  FILE: icalmemory.h
4  CREATOR: eric 30 June 1999
5
6
7  $Id$
8  $Locker$
9
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of either: 
12
13     The LGPL as published by the Free Software Foundation, version
14     2.1, available at: http://www.fsf.org/copyleft/lesser.html
15
16   Or:
17
18     The Mozilla Public License Version 1.0. You may obtain a copy of
19     the License at http://www.mozilla.org/MPL/
20
21  The Initial Developer of the Original Code is Eric Busboom
22
23  (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
24 ======================================================================*/
25
26 #ifndef ICALMEMORY_H
27 #define ICALMEMORY_H
28
29 #include <sys/types.h> /* for size_t */
30
31
32 /* Tmp buffers are managed by ical. References can be returned to the
33    caller, although the caller will not own the memory. */
34
35 void* icalmemory_tmp_buffer(size_t size);
36 char* icalmemory_tmp_copy(const char* str);
37
38 /* Add an externally allocated buffer to the ring. */
39 void  icalmemory_add_tmp_buffer(void*);
40
41
42 /* Free all memory used in the ring */
43 void icalmemory_free_ring(void);
44
45 /* Non-tmp buffers must be freed. These are mostly wrappers around
46  * malloc, etc, but are used so the caller can change the memory
47  * allocators in a future version of the library */
48
49 void* icalmemory_new_buffer(size_t size);
50 void* icalmemory_resize_buffer(void* buf, size_t size);
51 void icalmemory_free_buffer(void* buf);
52
53 /* icalmemory_append_string will copy the string 'string' to the
54    buffer 'buf' starting at position 'pos', reallocing 'buf' if it is
55    too small. 'buf_size' is the size of 'buf' and will be changed if
56    'buf' is reallocated. 'pos' will point to the last byte of the new
57    string in 'buf', usually a '\0' */
58
59 /* THESE ROUTINES CAN NOT BE USED ON TMP BUFFERS. Only use them on
60    normally allocated memory, or on buffers created from
61    icalmemory_new_buffer, never with buffers created by
62    icalmemory_tmp_buffer. If icalmemory_append_string has to resize a
63    buffer on the ring, the ring will loose track of it an you will
64    have memory problems. */
65
66 void icalmemory_append_string(char** buf, char** pos, size_t* buf_size, 
67                               const char* string);
68
69 /*  icalmemory_append_char is similar, but is appends a character instead of a string */
70 void icalmemory_append_char(char** buf, char** pos, size_t* buf_size, 
71                               char ch);
72
73 /* A wrapper around strdup. Partly to trap calls to strdup, partly
74    because in -ansi, gcc on Red Hat claims that strudup is undeclared */
75 char* icalmemory_strdup(const char *s);
76
77 #endif /* !ICALMEMORY_H */
78
79
80