aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-12-11 19:52:50 -0500
committerDavid Robillard <d@drobilla.net>2024-12-11 19:53:58 -0500
commit446e1a1e8817fb0f68662762e53828b6e1ff152e (patch)
treef87952f1ca1948c899a6fe8f61b369f5be9675f2
parent46e059efacd844e7f32f240e7efa441811b84527 (diff)
downloadlv2-446e1a1e8817fb0f68662762e53828b6e1ff152e.tar.xz
Simplify lv2_atom_equals()
There's no need to separately check the size and type here, since these are in the header of both atoms and can be compared along with everything else by a single call to memcmp().
-rw-r--r--include/lv2/atom/util.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/lv2/atom/util.h b/include/lv2/atom/util.h
index be53274..4b9e80d 100644
--- a/include/lv2/atom/util.h
+++ b/include/lv2/atom/util.h
@@ -1,4 +1,4 @@
-// Copyright 2008-2015 David Robillard <d@drobilla.net>
+// Copyright 2008-2024 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
#ifndef LV2_ATOM_UTIL_H
@@ -61,8 +61,7 @@ lv2_atom_is_null(const LV2_Atom* atom)
static inline bool
lv2_atom_equals(const LV2_Atom* a, const LV2_Atom* b)
{
- return (a == b) || ((a->type == b->type) && (a->size == b->size) &&
- !memcmp(a + 1, b + 1, a->size));
+ return (a == b) || !memcmp(a, b, sizeof(LV2_Atom) + a->size);
}
/**