From 34a6d05f9a84d0c6e07e12a976245a7d611d8e22 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 5 Sep 2011 06:25:51 +0200 Subject: [PATCH] blob_attr_equal: un-inline, add pointer checks --- blob.c | 15 +++++++++++++++ blob.h | 10 +--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/blob.c b/blob.c index 3929ad3..edf55d4 100644 --- a/blob.c +++ b/blob.c @@ -201,3 +201,18 @@ blob_parse(struct blob_attr *attr, struct blob_attr **data, const struct blob_at } return found; } + +bool +blob_attr_equal(const struct blob_attr *a1, const struct blob_attr *a2) +{ + if (!a1 && !a2) + return true; + + if (!a1 || !a2) + return false; + + if (blob_pad_len(a1) != blob_pad_len(a2)) + return false; + + return !memcmp(a1, a2, blob_pad_len(a1)); +} diff --git a/blob.h b/blob.h index 80ad7d0..10adde8 100644 --- a/blob.h +++ b/blob.h @@ -213,15 +213,7 @@ 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 bool blob_attr_equal(const struct blob_attr *a1, const struct blob_attr *a2); 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); -- 2.25.1