From de86040b2cf4ec9bfbb64f0e208a19d4d7e51adc Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Sun, 10 Apr 2022 14:11:46 +0200 Subject: Attribute list normalization cleanup --- lib/attrs.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/attrs.h') diff --git a/lib/attrs.h b/lib/attrs.h index 97a9630f..fcb70230 100644 --- a/lib/attrs.h +++ b/lib/attrs.h @@ -17,6 +17,8 @@ typedef struct adata { byte data[0]; } adata; +#define ADATA_SIZE(s) BIRD_CPU_ALIGN(sizeof(struct adata) + s) + extern const adata null_adata; /* adata of length 0 */ static inline struct adata * @@ -27,6 +29,14 @@ lp_alloc_adata(struct linpool *pool, uint len) return ad; } +static inline struct adata * +lp_store_adata(struct linpool *pool, const void *buf, uint len) +{ + struct adata *ad = lp_alloc_adata(pool, len); + memcpy(ad->data, buf, len); + return ad; +} + static inline int adata_same(const struct adata *a, const struct adata *b) { return (a->length == b->length && !memcmp(a->data, b->data, a->length)); } -- cgit v1.2.3