diff options
author | David Robillard <d@drobilla.net> | 2022-05-26 13:27:14 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-05-26 13:27:14 -0400 |
commit | ec24b754f1fa81f05b011a444a1dd8d67d066d31 (patch) | |
tree | 5f57f787159870d51aa68297ad7f0551ce842dab | |
parent | ea4336457f21658cfbc8a282b71d540135ff3d14 (diff) | |
download | lv2-ec24b754f1fa81f05b011a444a1dd8d67d066d31.tar.xz |
Avoid "else" after "return"
-rw-r--r-- | plugins/eg-params.lv2/params.c | 6 | ||||
-rw-r--r-- | plugins/eg-sampler.lv2/sampler.c | 20 | ||||
-rw-r--r-- | plugins/eg-scope.lv2/examploscope_ui.c | 4 |
3 files changed, 22 insertions, 8 deletions
diff --git a/plugins/eg-params.lv2/params.c b/plugins/eg-params.lv2/params.c index 8b96aa4..59f312c 100644 --- a/plugins/eg-params.lv2/params.c +++ b/plugins/eg-params.lv2/params.c @@ -199,10 +199,10 @@ unmap(Params* self, LV2_URID urid) { if (self->unmap) { return self->unmap->unmap(self->unmap->handle, urid); - } else { - snprintf(self->urid_buf, sizeof(self->urid_buf), "%u", urid); - return self->urid_buf; } + + snprintf(self->urid_buf, sizeof(self->urid_buf), "%u", urid); + return self->urid_buf; } static LV2_State_Status diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index e7fbbab..c141038 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -348,7 +348,9 @@ handle_event(Sampler* self, LV2_Atom_Event* ev) if (!property) { lv2_log_error(&self->logger, "Set message with no property\n"); return; - } else if (property->type != uris->atom_URID) { + } + + if (property->type != uris->atom_URID) { lv2_log_error(&self->logger, "Set property is not a URID\n"); return; } @@ -553,10 +555,13 @@ restore(LV2_Handle instance, uint32_t valflags = 0; const void* value = retrieve(handle, self->uris.eg_sample, &size, &type, &valflags); + if (!value) { lv2_log_error(&self->logger, "Missing eg:sample\n"); return LV2_STATE_ERR_NO_PROPERTY; - } else if (type != self->uris.atom_Path) { + } + + if (type != self->uris.atom_Path) { lv2_log_error(&self->logger, "Non-path eg:sample\n"); return LV2_STATE_ERR_BAD_TYPE; } @@ -593,11 +598,14 @@ restore(LV2_Handle instance, // Get param:gain from state value = retrieve(handle, self->uris.param_gain, &size, &type, &valflags); + if (!value) { // Not an error, since older versions did not save this property lv2_log_note(&self->logger, "Missing param:gain\n"); return LV2_STATE_SUCCESS; - } else if (type != self->uris.atom_Float) { + } + + if (type != self->uris.atom_Float) { lv2_log_error(&self->logger, "Non-float param:gain\n"); return LV2_STATE_ERR_BAD_TYPE; } @@ -614,11 +622,15 @@ extension_data(const char* uri) { static const LV2_State_Interface state = {save, restore}; static const LV2_Worker_Interface worker = {work, work_response, NULL}; + if (!strcmp(uri, LV2_STATE__interface)) { return &state; - } else if (!strcmp(uri, LV2_WORKER__interface)) { + } + + if (!strcmp(uri, LV2_WORKER__interface)) { return &worker; } + return NULL; } diff --git a/plugins/eg-scope.lv2/examploscope_ui.c b/plugins/eg-scope.lv2/examploscope_ui.c index e601843..8a9b588 100644 --- a/plugins/eg-scope.lv2/examploscope_ui.c +++ b/plugins/eg-scope.lv2/examploscope_ui.c @@ -261,7 +261,9 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) for (uint32_t i = start; i < end; ++i) { if (i == chn->idx) { continue; - } else if (i % 2) { + } + + if (i % 2) { cairo_line_to(cr, i - .5, CYPOS(chn->data_min[i])); cairo_line_to(cr, i - .5, CYPOS(chn->data_max[i])); ++pathlength; |