aboutsummaryrefslogtreecommitdiffstats
path: root/lv2/atom
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-23 13:47:44 +0200
committerDavid Robillard <d@drobilla.net>2018-09-23 13:47:44 +0200
commit9337cb4993f4db09567dc6e274b0a78aed99f136 (patch)
tree9f59fe3b1c321217959a5cd6dc07ff92fc834c11 /lv2/atom
parente7041238e4d5ee3bb7e10680e0d786e22c279b30 (diff)
downloadlv2-9337cb4993f4db09567dc6e274b0a78aed99f136.tar.xz
Shrink code slightly by removing some if-else structure
Diffstat (limited to 'lv2/atom')
-rw-r--r--lv2/atom/forge.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/lv2/atom/forge.h b/lv2/atom/forge.h
index befbb6e..a77170f 100644
--- a/lv2/atom/forge.h
+++ b/lv2/atom/forge.h
@@ -167,11 +167,7 @@ lv2_atom_forge_init(LV2_Atom_Forge* forge, LV2_URID_Map* map)
static inline LV2_Atom*
lv2_atom_forge_deref(LV2_Atom_Forge* forge, LV2_Atom_Forge_Ref ref)
{
- if (forge->buf) {
- return (LV2_Atom*)ref;
- } else {
- return forge->deref(forge->handle, ref);
- }
+ return forge->buf ? (LV2_Atom*)ref : forge->deref(forge->handle, ref);
}
/**
@@ -361,12 +357,10 @@ lv2_atom_forge_atom(LV2_Atom_Forge* forge, uint32_t size, uint32_t type)
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_primitive(LV2_Atom_Forge* forge, const LV2_Atom* a)
{
- if (lv2_atom_forge_top_is(forge, forge->Vector)) {
- return lv2_atom_forge_raw(forge, LV2_ATOM_BODY_CONST(a), a->size);
- } else {
- return lv2_atom_forge_write(
- forge, a, (uint32_t)sizeof(LV2_Atom) + a->size);
- }
+ return (lv2_atom_forge_top_is(forge, forge->Vector)
+ ? lv2_atom_forge_raw(forge, LV2_ATOM_BODY_CONST(a), a->size)
+ : lv2_atom_forge_write(
+ forge, a, (uint32_t)sizeof(LV2_Atom) + a->size));
}
/** Write an atom:Int. */