Mercurial > dovecot > core-2.2
annotate src/lib/imem.h @ 22664:fea53c2725c0
director: Fix director_max_parallel_moves/kicks type
Should be uint, not time.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 09 Nov 2017 12:24:16 +0200 |
parents | 54260e47d2e1 |
children |
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 | 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 | 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) |
22138
54260e47d2e1
lib: Add i_realloc_type() for i_realloc() that checks for overflows
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
17502
diff
changeset
|
9 #define i_realloc_type(mem, type, old_count, new_count) \ |
54260e47d2e1
lib: Add i_realloc_type() for i_realloc() that checks for overflows
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
17502
diff
changeset
|
10 p_realloc_type(default_pool, mem, type, old_count, new_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
|
11 |
17502
6abf982c268d
lib: Use __attribute__((returns_nonnull)) for the common memory/string functions.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
12 void *i_malloc(size_t size) ATTR_MALLOC ATTR_RETURNS_NONNULL; |
4720
b0daeec3d416
Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents:
4719
diff
changeset
|
13 void *i_realloc(void *mem, size_t old_size, size_t new_size) |
17502
6abf982c268d
lib: Use __attribute__((returns_nonnull)) for the common memory/string functions.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
14 ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL; |
0 | 15 |
4633
9de853d23279
Added p_free_and_null() and did some cleanups.
Timo Sirainen <tss@iki.fi>
parents:
3356
diff
changeset
|
16 #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
|
17 #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
|
18 |
0 | 19 /* string functions */ |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
20 char *i_strdup(const char *str) ATTR_MALLOC; |
4720
b0daeec3d416
Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents:
4719
diff
changeset
|
21 /* like i_strdup(), but if str == "", return NULL */ |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
22 char *i_strdup_empty(const char *str) ATTR_MALLOC; |
4720
b0daeec3d416
Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents:
4719
diff
changeset
|
23 /* *end isn't included */ |
17502
6abf982c268d
lib: Use __attribute__((returns_nonnull)) for the common memory/string functions.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
24 char *i_strdup_until(const void *str, const void *end) |
6abf982c268d
lib: Use __attribute__((returns_nonnull)) for the common memory/string functions.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
25 ATTR_MALLOC ATTR_RETURNS_NONNULL; |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
26 char *i_strndup(const void *str, size_t max_chars) ATTR_MALLOC; |
4720
b0daeec3d416
Use malloc attribute for the most commonly used memory and string allocation
Timo Sirainen <tss@iki.fi>
parents:
4719
diff
changeset
|
27 char *i_strdup_printf(const char *format, ...) |
17502
6abf982c268d
lib: Use __attribute__((returns_nonnull)) for the common memory/string functions.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
28 ATTR_FORMAT(1, 2) ATTR_MALLOC ATTR_RETURNS_NONNULL; |
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_strdup_vprintf(const char *format, va_list args) |
17502
6abf982c268d
lib: Use __attribute__((returns_nonnull)) for the common memory/string functions.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
30 ATTR_FORMAT(1, 0) ATTR_MALLOC ATTR_RETURNS_NONNULL; |
0 | 31 |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
32 char *i_strconcat(const char *str1, ...) ATTR_SENTINEL ATTR_MALLOC; |
0 | 33 |
34 #endif |