annotate src/lib/imem.h @ 6410:e4eb71ae8e96 HEAD

Changed .h ifdef/defines to use <NAME>_H format.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Sep 2007 11:31:27 +0300
parents 48fe4fe9ef64
children 6a64e64fa3a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6410
e4eb71ae8e96 Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents: 5356
diff changeset
1 #ifndef IMEM_H
e4eb71ae8e96 Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents: 5356
diff changeset
2 #define IMEM_H
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
4633
9de853d23279 Added p_free_and_null() and did some cleanups.
Timo Sirainen <tss@iki.fi>
parents: 3356
diff changeset
4 /* For easy allocation of memory from default memory pool. */
9de853d23279 Added p_free_and_null() and did some cleanups.
Timo Sirainen <tss@iki.fi>
parents: 3356
diff changeset
5
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
6 extern pool_t default_pool;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7
4633
9de853d23279 Added p_free_and_null() and did some cleanups.
Timo Sirainen <tss@iki.fi>
parents: 3356
diff changeset
8 #define i_new(type, count) p_new(default_pool, type, count)
1784
0e72d6ab85ad Make i_free(), p_free() and pool_unref() calls also set the given parameter
Timo Sirainen <tss@iki.fi>
parents: 941
diff changeset
9
4720
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
10 void *i_malloc(size_t size) __attr_malloc__;
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
11 void *i_realloc(void *mem, size_t old_size, size_t new_size)
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
12 __attr_warn_unused_result__;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13
4633
9de853d23279 Added p_free_and_null() and did some cleanups.
Timo Sirainen <tss@iki.fi>
parents: 3356
diff changeset
14 #define i_free(mem) p_free(default_pool, mem)
9de853d23279 Added p_free_and_null() and did some cleanups.
Timo Sirainen <tss@iki.fi>
parents: 3356
diff changeset
15 #define i_free_and_null(mem) p_free_and_null(default_pool, mem)
3356
02479b3894cc Added i_free_and_null() macro and first use case.
Timo Sirainen <tss@iki.fi>
parents: 1784
diff changeset
16
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
17 /* string functions */
4720
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
18 char *i_strdup(const char *str) __attr_malloc__;
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
19 /* like i_strdup(), but if str == "", return NULL */
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
20 char *i_strdup_empty(const char *str) __attr_malloc__;
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
21 /* *end isn't included */
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
22 char *i_strdup_until(const void *str, const void *end) __attr_malloc__;
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
23 char *i_strndup(const void *str, size_t max_chars) __attr_malloc__;
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
24 char *i_strdup_printf(const char *format, ...)
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
25 __attr_format__(1, 2) __attr_malloc__;
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
26 char *i_strdup_vprintf(const char *format, va_list args)
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
27 __attr_format__(1, 0) __attr_malloc__;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
28
4720
b0daeec3d416 Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents: 4719
diff changeset
29 char *i_strconcat(const char *str1, ...) __attr_sentinel__ __attr_malloc__;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
30
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31 #endif