From 00a18033488d72aa68a2f5e23a9bb7157abb96e1 Mon Sep 17 00:00:00 2001 From: o9000 Date: Sat, 8 Aug 2015 08:51:44 +0200 Subject: [PATCH] if( -> if ( --- src/battery/battery.c | 2 +- src/battery/linux.c | 18 +++++++++--------- src/config.c | 2 +- src/tint.c | 16 ++++++++-------- src/util/common.h | 6 +++--- src/util/uevent.c | 6 +++--- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/battery/battery.c b/src/battery/battery.c index ba7b82e..176022c 100644 --- a/src/battery/battery.c +++ b/src/battery/battery.c @@ -75,7 +75,7 @@ void update_battery_tick(void* arg) } if (old_ac_connected != battery_state.ac_connected) { - if(battery_state.ac_connected) + if (battery_state.ac_connected) tint_exec(ac_connected_cmd); else tint_exec(ac_disconnected_cmd); diff --git a/src/battery/linux.c b/src/battery/linux.c index 1897706..91c870f 100644 --- a/src/battery/linux.c +++ b/src/battery/linux.c @@ -82,7 +82,7 @@ static struct uevent_notify psy_plug = { uevent_battery_plug }; -#define RETURN_ON_ERROR(err) if(error) { g_error_free(err); return FALSE; } +#define RETURN_ON_ERROR(err) if (error) { g_error_free(err); return FALSE; } static GList *batteries = NULL; static GList *mains = NULL; @@ -104,12 +104,12 @@ static enum psy_type power_supply_get_type(const gchar *entryname) { return PSY_UNKNOWN; } - if(!g_strcmp0(type, "Battery\n")) { + if (!g_strcmp0(type, "Battery\n")) { g_free(type); return PSY_BATTERY; } - if(!g_strcmp0(type, "Mains\n")) { + if (!g_strcmp0(type, "Mains\n")) { g_free(type); return PSY_MAINS; } @@ -140,7 +140,7 @@ static gboolean init_linux_battery(struct psy_battery *bat) { goto err1; } - if(!bat->energy_in_uamp) { + if (!bat->energy_in_uamp) { bat->path_energy_full = g_build_filename("/sys/class/power_supply", entryname, "energy_full", NULL); if (!g_file_test(bat->path_energy_full, G_FILE_TEST_EXISTS)) goto err2; @@ -234,7 +234,7 @@ static void add_battery(const char *entryname) { struct psy_battery *bat = g_malloc0(sizeof(*bat)); bat->name = g_strdup(entryname); - if(init_linux_battery(bat)) { + if (init_linux_battery(bat)) { batteries = g_list_append(batteries, bat); fprintf(stdout, "found battery \"%s\"\n", bat->name); } else { @@ -247,7 +247,7 @@ static void add_mains(const char *entryname) { struct psy_mains *ac = g_malloc0(sizeof(*ac)); ac->name = g_strdup(entryname); - if(init_linux_mains(ac)) { + if (init_linux_mains(ac)) { mains = g_list_append(mains, ac); fprintf(stdout, "found mains \"%s\"\n", ac->name); } else { @@ -308,7 +308,7 @@ static gboolean update_linux_battery(struct psy_battery *bat) { g_free(data); /* we are done, if battery is not present */ - if(!bat->present) + if (!bat->present) return TRUE; /* status */ @@ -403,9 +403,9 @@ int battery_os_update(struct batstate *state) { /* calculate seconds */ if (total_power_now > 0) { - if(state->state == BATTERY_CHARGING) + if (state->state == BATTERY_CHARGING) seconds = 3600 * (total_energy_full - total_energy_now) / total_power_now; - else if(state->state == BATTERY_DISCHARGING) + else if (state->state == BATTERY_DISCHARGING) seconds = 3600 * total_energy_now / total_power_now; } batstate_set_time(state, seconds); diff --git a/src/config.c b/src/config.c index 9a8c625..90416f8 100644 --- a/src/config.c +++ b/src/config.c @@ -354,7 +354,7 @@ void add_entry (char *key, char *value) else if (strcmp (key, "battery_low_status") == 0) { #ifdef ENABLE_BATTERY battery_low_status = atoi(value); - if(battery_low_status < 0 || battery_low_status > 100) + if (battery_low_status < 0 || battery_low_status > 100) battery_low_status = 0; #endif } diff --git a/src/tint.c b/src/tint.c index c03e089..535fb31 100644 --- a/src/tint.c +++ b/src/tint.c @@ -438,7 +438,7 @@ int tint2_handles_click(Panel* panel, XButtonEvent* e) { Task* task = click_task(panel, e->x, e->y); if (task) { - if( (e->button == 1 && mouse_left != 0) + if ( (e->button == 1 && mouse_left != 0) || (e->button == 2 && mouse_middle != 0) || (e->button == 3 && mouse_right != 0) || (e->button == 4 && mouse_scroll_up != 0) @@ -521,27 +521,27 @@ void event_button_press (XEvent *e) void event_button_motion_notify (XEvent *e) { Panel * panel = get_panel(e->xany.window); - if(!panel || !task_drag) + if (!panel || !task_drag) return; // Find the taskbar on the event's location Taskbar * event_taskbar = click_taskbar(panel, e->xbutton.x, e->xbutton.y); - if(event_taskbar == NULL) + if (event_taskbar == NULL) return; // Find the task on the event's location Task * event_task = click_task(panel, e->xbutton.x, e->xbutton.y); // If the event takes place on the same taskbar as the task being dragged - if(event_taskbar == task_drag->area.parent) { + if (event_taskbar == task_drag->area.parent) { if (taskbar_sort_method != TASKBAR_NOSORT) { sort_tasks(event_taskbar); } else { // Swap the task_drag with the task on the event's location (if they differ) - if(event_task && event_task != task_drag) { + if (event_task && event_task != task_drag) { GList * drag_iter = g_list_find(event_taskbar->area.list, task_drag); GList * task_iter = g_list_find(event_taskbar->area.list, event_task); - if(drag_iter && task_iter) { + if (drag_iter && task_iter) { gpointer temp = task_iter->data; task_iter->data = drag_iter->data; drag_iter->data = temp; @@ -553,13 +553,13 @@ void event_button_motion_notify (XEvent *e) } } else { // The event is on another taskbar than the task being dragged - if(task_drag->desktop == ALLDESKTOP || panel_mode != MULTI_DESKTOP) + if (task_drag->desktop == ALLDESKTOP || panel_mode != MULTI_DESKTOP) return; Taskbar * drag_taskbar = (Taskbar*)task_drag->area.parent; drag_taskbar->area.list = g_list_remove(drag_taskbar->area.list, task_drag); - if(event_taskbar->area.posx > drag_taskbar->area.posx || event_taskbar->area.posy > drag_taskbar->area.posy) { + if (event_taskbar->area.posx > drag_taskbar->area.posx || event_taskbar->area.posy > drag_taskbar->area.posy) { int i = (taskbarname_enabled) ? 1 : 0; event_taskbar->area.list = g_list_insert(event_taskbar->area.list, task_drag, i); } diff --git a/src/util/common.h b/src/util/common.h index e197259..a59d4ad 100644 --- a/src/util/common.h +++ b/src/util/common.h @@ -20,15 +20,15 @@ /* void fxfree(void** ptr){ - if(*ptr){ + if (*ptr){ free(*ptr); *ptr=NULL; } } FXint fxmalloc(void** ptr,unsigned long size){ *ptr=NULL; - if(size!=0){ - if((*ptr=malloc(size))==NULL) return FALSE; + if (size!=0){ + if ((*ptr=malloc(size))==NULL) return FALSE; } return TRUE; } diff --git a/src/util/uevent.c b/src/util/uevent.c index 9a9959f..47d0f09 100644 --- a/src/util/uevent.c +++ b/src/util/uevent.c @@ -108,7 +108,7 @@ static struct uevent *uevent_new(char *buffer, int size) { val = strchr(s, '='); if (val) { struct uevent_parameter *param = malloc(sizeof(*param)); - if(param) { + if (param) { param->key = strndup(s, val-s); param->val = strdup(val+1); ev->params = g_list_append(ev->params, param); @@ -132,7 +132,7 @@ void uevent_unregister_notifier(struct uevent_notify *nb) { GList *next = l->next; struct uevent_notify *lnb = l->data; - if(memcmp(nb, lnb, sizeof(struct uevent_notify)) == 0) + if (memcmp(nb, lnb, sizeof(struct uevent_notify)) == 0) notifiers = g_list_delete_link(notifiers, l); l = next; @@ -152,7 +152,7 @@ void uevent_handler() { return; ev = uevent_new(buf, len); - if(ev) { + if (ev) { for (l = notifiers; l != NULL; l = l->next) { struct uevent_notify *nb = l->data;