From 5d161ecc2079b67e0350715dc531ea684257a8ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 4 Feb 2015 15:43:39 -0500 Subject: [PATCH] Cleanup: Use a switch case instead of conditionals MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/event-types.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/formats/ctf/ir/event-types.c b/formats/ctf/ir/event-types.c index c24ef93fc..e0df09bb9 100644 --- a/formats/ctf/ir/event-types.c +++ b/formats/ctf/ir/event-types.c @@ -336,12 +336,19 @@ int bt_ctf_field_type_validate(struct bt_ctf_field_type *type) goto end; } - if (type->declaration->id == CTF_TYPE_ENUM) { + switch (type->declaration->id) { + case CTF_TYPE_ENUM: + { struct bt_ctf_field_type_enumeration *enumeration = container_of(type, struct bt_ctf_field_type_enumeration, parent); + /* Ensure enum has entries */ ret = enumeration->entries->len ? 0 : -1; + break; + } + default: + break; } end: return ret; -- 2.34.1