From: Jérémie Galarneau Date: Wed, 4 Feb 2015 20:43:39 +0000 (-0500) Subject: Cleanup: Use a switch case instead of conditionals X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=5d161ecc2079b67e0350715dc531ea684257a8ae;p=deliverable%2Fbabeltrace.git Cleanup: Use a switch case instead of conditionals Signed-off-by: Jérémie Galarneau --- 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;