summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2011-09-05 04:09:32 +0000
committerFelix Fietkau2011-09-05 04:09:32 +0000
commitb1c320132e5adac3c3ba5545c66123b0618f8cd0 (patch)
treef64c60e93e652c2b22080e5798605cbdc554aecb
parent1d3e4ccb6ae544dfc75227434c42b1ee74b86d4f (diff)
downloadlibubox-b1c320132e5adac3c3ba5545c66123b0618f8cd0.tar.gz
add blob_attr_equal() for comparing attributes
-rw-r--r--blob.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/blob.h b/blob.h
index 6e73093..80ad7d0 100644
--- a/blob.h
+++ b/blob.h
@@ -213,6 +213,15 @@ blob_next(const struct blob_attr *attr)
return (struct blob_attr *) ((char *) attr + blob_pad_len(attr));
}
+static inline bool
+blob_attr_equal(const struct blob_attr *a1, const struct blob_attr *a2)
+{
+ if (blob_pad_len(a1) != blob_pad_len(a2))
+ return false;
+
+ return !memcmp(a1, a2, blob_pad_len(a1));
+}
+
extern int blob_buf_init(struct blob_buf *buf, int id);
extern void blob_buf_free(struct blob_buf *buf);
extern struct blob_attr *blob_new(struct blob_buf *buf, int id, int payload);