summaryrefslogtreecommitdiff
path: root/lib/attrs.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-04-10 14:11:46 +0200
committerMaria Matejka <mq@ucw.cz>2022-05-04 15:37:41 +0200
commitde86040b2cf4ec9bfbb64f0e208a19d4d7e51adc (patch)
tree930de20f9c75a4a2e4f9bb281dd1499888ae8b6a /lib/attrs.h
parent0b871c170472202770691af8995766ee57920fdc (diff)
Attribute list normalization cleanup
Diffstat (limited to 'lib/attrs.h')
-rw-r--r--lib/attrs.h10
1 files changed, 10 insertions, 0 deletions
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)); }