blob_attr_equal: un-inline, add pointer checks
This commit is contained in:
parent
b1c320132e
commit
34a6d05f9a
2 changed files with 16 additions and 9 deletions
15
blob.c
15
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));
|
||||
}
|
||||
|
|
10
blob.h
10
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);
|
||||
|
|
Loading…
Reference in a new issue