mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 17:51:53 +00:00
Merge commit '2d6fb31c' into thread-merge-2.16
This commit is contained in:
commit
2af438a9bf
@ -114,7 +114,8 @@ static inline int u64_cmp(u64 i1, u64 i2)
|
|||||||
#define USE_RESULT __atribute__((warn_unused_result))
|
#define USE_RESULT __atribute__((warn_unused_result))
|
||||||
#define UNUSED __attribute__((unused))
|
#define UNUSED __attribute__((unused))
|
||||||
#define PACKED __attribute__((packed))
|
#define PACKED __attribute__((packed))
|
||||||
#define NONNULL(...) __attribute__((nonnull((__VA_ARGS__))))
|
#define NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||||
|
#define ALLOC_SIZE(...) __attribute__((alloc_size(__VA_ARGS__)))
|
||||||
#define CLEANUP(fun) __attribute__((cleanup(fun)))
|
#define CLEANUP(fun) __attribute__((cleanup(fun)))
|
||||||
|
|
||||||
#define STATIC_ASSERT(EXP) _Static_assert(EXP, #EXP)
|
#define STATIC_ASSERT(EXP) _Static_assert(EXP, #EXP)
|
||||||
|
@ -81,9 +81,9 @@ static inline pool *resource_parent(resource *r)
|
|||||||
|
|
||||||
/* Normal memory blocks */
|
/* Normal memory blocks */
|
||||||
|
|
||||||
void *mb_alloc(pool *, unsigned size);
|
void *mb_alloc(pool *, unsigned size) ALLOC_SIZE(2);
|
||||||
void *mb_allocz(pool *, unsigned size);
|
void *mb_allocz(pool *, unsigned size) ALLOC_SIZE(2);
|
||||||
void *mb_realloc(void *m, unsigned size);
|
void *mb_realloc(void *m, unsigned size) ALLOC_SIZE(2);
|
||||||
void mb_free(void *);
|
void mb_free(void *);
|
||||||
|
|
||||||
/* Memory pools with linear allocation */
|
/* Memory pools with linear allocation */
|
||||||
@ -97,9 +97,9 @@ typedef struct lp_state {
|
|||||||
} lp_state;
|
} lp_state;
|
||||||
|
|
||||||
linpool *lp_new(pool *);
|
linpool *lp_new(pool *);
|
||||||
void *lp_alloc(linpool *, unsigned size); /* Aligned */
|
void *lp_alloc(linpool *, unsigned size) ALLOC_SIZE(2); /* Aligned */
|
||||||
void *lp_allocu(linpool *, unsigned size); /* Unaligned */
|
void *lp_allocu(linpool *, unsigned size) ALLOC_SIZE(2); /* Unaligned */
|
||||||
void *lp_allocz(linpool *, unsigned size); /* With clear */
|
void *lp_allocz(linpool *, unsigned size) ALLOC_SIZE(2); /* With clear */
|
||||||
void lp_flush(linpool *); /* Free everything, but leave linpool */
|
void lp_flush(linpool *); /* Free everything, but leave linpool */
|
||||||
lp_state *lp_save(linpool *m); /* Save state */
|
lp_state *lp_save(linpool *m); /* Save state */
|
||||||
void lp_restore(linpool *m, lp_state *p); /* Restore state */
|
void lp_restore(linpool *m, lp_state *p); /* Restore state */
|
||||||
|
Loading…
Reference in New Issue
Block a user