Skip to content

Commit

Permalink
Don't put if-statements and blocks in the same single line
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidr committed Apr 22, 2019
1 parent f8102a5 commit 976d3ed
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ void devices_update_list(void) {}
void devices_update_ui(void) {
if (!devices) {
panel_settings_devices.child = calloc(3, sizeof(void *));
if (!panel_settings_devices.child) { LOG_FATAL_ERR(EXIT_MALLOC, "Devices", "Could not alloc memory"); }
if (!panel_settings_devices.child) {
LOG_FATAL_ERR(EXIT_MALLOC, "Devices", "Could not alloc memory");
}
panel_settings_devices.child[0] = (void *)&button_add_new_device_to_self;
panel_settings_devices.child[1] = (void *)&edit_add_new_device_to_self;
panel_settings_devices.child[2] = NULL;
Expand All @@ -109,13 +111,17 @@ void devices_update_ui(void) {

if (!panel_settings_devices.child) {
panel_settings_devices.child = calloc(3 + self.device_list_count * 2, sizeof(void *));
if (!panel_settings_devices.child) { LOG_FATAL_ERR(EXIT_MALLOC, "Devices", "Could not alloc memory"); }
if (!panel_settings_devices.child) {
LOG_FATAL_ERR(EXIT_MALLOC, "Devices", "Could not alloc memory");
}
panel_settings_devices.child[0] = (void *)&button_add_new_device_to_self;
panel_settings_devices.child[1] = (void *)&edit_add_new_device_to_self;
} else {
panel_settings_devices.child =
realloc(panel_settings_devices.child, (3 + self.device_list_count * 2) * sizeof(void *));
if (!panel_settings_devices.child) { LOG_FATAL_ERR(EXIT_MALLOC, "Devices", "Could not alloc memory"); }
if (!panel_settings_devices.child) {
LOG_FATAL_ERR(EXIT_MALLOC, "Devices", "Could not alloc memory");
}
}

uint16_t i;
Expand Down

0 comments on commit 976d3ed

Please sign in to comment.