Skip to content

Commit

Permalink
Add a "finish" label in callbacks
Browse files Browse the repository at this point in the history
When a call back finishes without error, or if there is an
error but we don't use g_dbus_method_invocation_xxxerror,
we need to call blocaled_locale1_complete_xxx. Since
the code may come from various places, add a "finish" label
before this call. We only use a goto once, but it may be handy
to have it if we add further code paths.
  • Loading branch information
pierre-labastie committed Aug 30, 2023
1 parent 1b8e828 commit f1b5e21
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/localed.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified in 2019, 2020 by Pierre Labastie. See git log
Modified in 2019, 2020, 2023 by Pierre Labastie. See git log
*/

#include <limits.h>
Expand Down Expand Up @@ -932,6 +932,7 @@ on_handle_set_locale_authorized_cb (GObject *source_object,
}

blocaled_locale1_set_locale (locale1, (const gchar * const *) locale);
finish:
blocaled_locale1_complete_set_locale (locale1, data->invocation);

unlock:
Expand Down Expand Up @@ -1048,8 +1049,7 @@ on_handle_set_vconsole_keyboard_authorized_cb (GObject *source_object,
filename = g_file_get_path (kbd_model_map_file);
g_printerr ("Failed to find conversion entry for console keymap '%s' in '%s'\n", data->vconsole_keymap, filename);
g_free (filename);
blocaled_locale1_complete_set_vconsole_keyboard (locale1, data->invocation);
goto unlock;
goto finish;
} else {
unsigned int failure_score = 0;

Expand Down Expand Up @@ -1083,6 +1083,7 @@ on_handle_set_vconsole_keyboard_authorized_cb (GObject *source_object,
}
}

finish:
blocaled_locale1_complete_set_vconsole_keyboard (locale1, data->invocation);

unlock:
Expand Down Expand Up @@ -1229,6 +1230,7 @@ on_handle_set_x11_keyboard_authorized_cb (GObject *source_object,
}
}

finish:
blocaled_locale1_complete_set_x11_keyboard (locale1, data->invocation);

unlock:
Expand Down

0 comments on commit f1b5e21

Please sign in to comment.