From cc887a265cc36c6ba2fe9d9051a311adb41da1ca Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 14 Nov 2012 09:57:11 +0000 Subject: [PATCH] formatting DEAR CEDRIC: PLEASE LEARN HOW TO FORMAT YOUR CODE CORRECTLY. THANKS. SVN revision: 79276 --- src/bin/e_alert.c | 3 +- src/bin/e_alert_main.c | 102 +++++++++++++++++++++-------------------- src/bin/e_signals.c | 36 ++++++++------- src/bin/e_start_main.c | 52 ++++++++++----------- src/bin/e_startup.c | 39 ++++++++-------- 5 files changed, 120 insertions(+), 112 deletions(-) diff --git a/src/bin/e_alert.c b/src/bin/e_alert.c index a38c2526b..330744ad1 100644 --- a/src/bin/e_alert.c +++ b/src/bin/e_alert.c @@ -37,5 +37,6 @@ e_alert_show(void) fprintf(stderr, "PAUSE !\n"); pause(); } - return ; + return; } + diff --git a/src/bin/e_alert_main.c b/src/bin/e_alert_main.c index 77e2af7d4..a9044370c 100644 --- a/src/bin/e_alert_main.c +++ b/src/bin/e_alert_main.c @@ -16,32 +16,32 @@ #include #include -#define WINDOW_WIDTH 320 -#define WINDOW_HEIGHT 240 +#define WINDOW_WIDTH 320 +#define WINDOW_HEIGHT 240 #ifndef XCB_ATOM_NONE # define XCB_ATOM_NONE 0 #endif /* local function prototypes */ -static int _e_alert_connect(void); -static void _e_alert_create(void); -static void _e_alert_display(void); -static void _e_alert_button_move_resize(xcb_window_t btn, int x, int y, int w, int h); -static void _e_alert_window_raise(xcb_window_t win); -static void _e_alert_sync(void); -static void _e_alert_shutdown(void); -static void _e_alert_run(void); -static void _e_alert_draw(void); -static int _e_alert_handle_key_press(xcb_generic_event_t *event); -static int _e_alert_handle_button_press(xcb_generic_event_t *event); +static int _e_alert_connect(void); +static void _e_alert_create(void); +static void _e_alert_display(void); +static void _e_alert_button_move_resize(xcb_window_t btn, int x, int y, int w, int h); +static void _e_alert_window_raise(xcb_window_t win); +static void _e_alert_sync(void); +static void _e_alert_shutdown(void); +static void _e_alert_run(void); +static void _e_alert_draw(void); +static int _e_alert_handle_key_press(xcb_generic_event_t *event); +static int _e_alert_handle_button_press(xcb_generic_event_t *event); static xcb_char2b_t *_e_alert_build_string(const char *str); -static void _e_alert_draw_outline(void); -static void _e_alert_draw_title_outline(void); -static void _e_alert_draw_title(void); -static void _e_alert_draw_text(void); -static void _e_alert_draw_button_outlines(void); -static void _e_alert_draw_button_text(void); +static void _e_alert_draw_outline(void); +static void _e_alert_draw_title_outline(void); +static void _e_alert_draw_title(void); +static void _e_alert_draw_text(void); +static void _e_alert_draw_button_outlines(void); +static void _e_alert_draw_button_text(void); /* local variables */ static xcb_connection_t *conn = NULL; @@ -71,16 +71,16 @@ main(int argc, char **argv) (!strcmp(argv[i], "-help")) || (!strcmp(argv[i], "--help"))) { - printf("This is an internal tool for Enlightenment.\n" - "do not use it.\n"); - exit(0); - } - else if (i == 1) - sig = atoi(argv[i]); // signal + printf("This is an internal tool for Enlightenment.\n" + "do not use it.\n"); + exit(0); + } + else if (i == 1) + sig = atoi(argv[i]); // signal else if (i == 2) - pid = atoi(argv[i]); // E's pid - else if (i == 3) - backtrace_str = argv[i]; + pid = atoi(argv[i]); // E's pid + else if (i == 3) + backtrace_str = argv[i]; } tmp = getenv("E17_TAINTED"); @@ -313,7 +313,7 @@ _e_alert_display(void) /* grab pointer & keyboard */ xcb_grab_pointer_unchecked(conn, 0, win, (XCB_EVENT_MASK_BUTTON_PRESS | - XCB_EVENT_MASK_BUTTON_RELEASE), + XCB_EVENT_MASK_BUTTON_RELEASE), XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE, XCB_CURRENT_TIME); xcb_grab_keyboard_unchecked(conn, 0, win, XCB_CURRENT_TIME, @@ -389,21 +389,24 @@ _e_alert_run(void) case XCB_BUTTON_PRESS: ret = _e_alert_handle_button_press(event); break; + case XCB_KEY_PRESS: ret = _e_alert_handle_key_press(event); break; + case XCB_EXPOSE: - { - xcb_expose_event_t *ev; + { + xcb_expose_event_t *ev; - ev = (xcb_expose_event_t *)event; - if (ev->window != win) break; + ev = (xcb_expose_event_t *)event; + if (ev->window != win) break; - _e_alert_draw(); - _e_alert_sync(); + _e_alert_draw(); + _e_alert_sync(); + + break; + } - break; - } default: break; } @@ -517,15 +520,16 @@ _e_alert_draw_title(void) xcb_image_text_8(conn, strlen(title), win, gc, x, y, title); } -struct { - int signal; - const char *name; +struct +{ + int signal; + const char *name; } signal_name[5] = { - { SIGSEGV, "SEGV" }, - { SIGILL, "SIGILL" }, - { SIGFPE, "SIGFPE" }, - { SIGBUS, "SIGBUS" }, - { SIGABRT, "SIGABRT" } + { SIGSEGV, "SEGV" }, + { SIGILL, "SIGILL" }, + { SIGFPE, "SIGFPE" }, + { SIGBUS, "SIGBUS" }, + { SIGABRT, "SIGABRT" } }; static void @@ -561,7 +565,6 @@ _e_alert_draw_text(void) "\n" "Please compile latest svn E17 and EFL with\n" "-g and -ggdb3 in your CFLAGS.\n", pid); - } } else @@ -572,7 +575,7 @@ _e_alert_draw_text(void) "modules; before reporting this issue, please\n" "unload them and try to see if the bug is still\n" "there. Also update to latest svn and be sure to\n" - "compile E17 and EFL with -g and -ggdb3 in your CFLAGS"); + "compile E17 and EFL with -g and -ggdb3 in your CFLAGS"); } strcpy(warn, ""); @@ -580,8 +583,8 @@ _e_alert_draw_text(void) for (i = 0; i < sizeof(signal_name) / sizeof(signal_name[0]); ++i) if (signal_name[i].signal == sig) snprintf(warn, sizeof(warn), - "This is very bad. Enlightenment %s'd.", - signal_name[i].name); + "This is very bad. Enlightenment %s'd.", + signal_name[i].name); /* draw text */ k = (fh + 12); @@ -661,3 +664,4 @@ _e_alert_draw_button_text(void) xcb_image_text_8(conn, strlen(str2), btn2, gc, x, (10 + fa), str2); } + diff --git a/src/bin/e_signals.c b/src/bin/e_signals.c index d572015dc..784498161 100644 --- a/src/bin/e_signals.c +++ b/src/bin/e_signals.c @@ -17,7 +17,7 @@ _e_x_composite_shutdown(void) // Ecore_X_Display *dpy; Ecore_X_Window root; - if (_e_x_composite_shutdown_try) return; /* we failed :-( */ + if (_e_x_composite_shutdown_try) return; /* we failed :-( */ _e_x_composite_shutdown_try = 1; // dpy = ecore_x_display_get(); @@ -36,24 +36,25 @@ _e_write_safe_int(int fd, const char *buf, size_t size) { while (size > 0) { - ssize_t done = write(fd, buf, size); - if (done >= 0) - { - buf += done; - size -= done; - } - else - { - if ((errno == EAGAIN) || (errno == EINTR)) - continue; - else - { - perror("write"); - return; - } - } + ssize_t done = write(fd, buf, size); + if (done >= 0) + { + buf += done; + size -= done; + } + else + { + if ((errno == EAGAIN) || (errno == EINTR)) + continue; + else + { + perror("write"); + return; + } + } } } + #endif /* a tricky little devil, requires e and it's libs to be built @@ -120,3 +121,4 @@ e_sigabrt_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED_ ecore_x_sync(); e_alert_show(); } + diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c index 7dac703d0..e801443cb 100644 --- a/src/bin/e_start_main.c +++ b/src/bin/e_start_main.c @@ -218,14 +218,14 @@ _env_path_append(const char *env, const char *path) } } -static void +static void _sigusr1(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) { struct sigaction action; - + /* release ptrace */ stop_ptrace = EINA_TRUE; - + action.sa_sigaction = _sigusr1; action.sa_flags = SA_RESETHAND; sigemptyset(&action.sa_mask); @@ -244,7 +244,7 @@ main(int argc, char **argv) Eina_Bool really_know = EINA_FALSE; struct sigaction action; #if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \ - !(defined (__MACH__) && defined (__APPLE__)) + !(defined (__MACH__) && defined (__APPLE__)) Eina_Bool restart = EINA_TRUE; #endif @@ -252,12 +252,12 @@ main(int argc, char **argv) action.sa_flags = SA_RESETHAND; sigemptyset(&action.sa_mask); sigaction(SIGUSR1, &action, NULL); - + eina_init(); /* reexcute myself with dbus-launch if dbus-launch is not running yet */ if ((!getenv("DBUS_SESSION_BUS_ADDRESS")) && - (!getenv("DBUS_LAUNCHD_SESSION_BUS_SOCKET"))) + (!getenv("DBUS_LAUNCHD_SESSION_BUS_SOCKET"))) { char **dbus_argv; @@ -410,7 +410,7 @@ main(int argc, char **argv) /* not run at the moment !! */ #if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \ - !(defined (__MACH__) && defined (__APPLE__)) + !(defined (__MACH__) && defined (__APPLE__)) /* Now looping until */ while (restart) { @@ -451,10 +451,10 @@ main(int argc, char **argv) #endif while (!done) { - Eina_Bool remember_sigill = EINA_FALSE; - Eina_Bool remember_sigusr1 = EINA_FALSE; + Eina_Bool remember_sigill = EINA_FALSE; + Eina_Bool remember_sigusr1 = EINA_FALSE; - result = waitpid(child, &status, 0); + result = waitpid(child, &status, 0); if (result == child) { @@ -467,25 +467,25 @@ main(int argc, char **argv) int back; #ifdef HAVE_SYS_PTRACE_H - if (!really_know) - r = ptrace(PTRACE_GETSIGINFO, child, NULL, &sig); + if (!really_know) + r = ptrace(PTRACE_GETSIGINFO, child, NULL, &sig); #endif back = r == 0 && sig.si_signo != SIGTRAP ? sig.si_signo : 0; - if (sig.si_signo == SIGUSR1) - { - if (remember_sigill) - remember_sigusr1 = EINA_TRUE; - } - else if (sig.si_signo == SIGILL) - { - remember_sigill = EINA_TRUE; - } - else - { - remember_sigill = EINA_FALSE; - } + if (sig.si_signo == SIGUSR1) + { + if (remember_sigill) + remember_sigusr1 = EINA_TRUE; + } + else if (sig.si_signo == SIGILL) + { + remember_sigill = EINA_TRUE; + } + else + { + remember_sigill = EINA_FALSE; + } if (r != 0 || (sig.si_signo != SIGSEGV && @@ -497,7 +497,7 @@ main(int argc, char **argv) if (!really_know) ptrace(PT_CONTINUE, child, NULL, back); #endif - continue ; + continue; } #ifdef HAVE_SYS_PTRACE_H if (!really_know) diff --git a/src/bin/e_startup.c b/src/bin/e_startup.c index 2702bc35e..c60c79892 100644 --- a/src/bin/e_startup.c +++ b/src/bin/e_startup.c @@ -6,8 +6,8 @@ */ /* local subsystem functions */ -static void _e_startup(void); -static void _e_startup_next_cb(void *data); +static void _e_startup(void); +static void _e_startup_next_cb(void *data); static Eina_Bool _e_startup_event_cb(void *data, int ev_type, void *ev); /* local subsystem globals */ @@ -23,20 +23,20 @@ e_startup(E_Startup_Mode mode) if (mode == E_STARTUP_START) { - e_user_dir_concat_static(buf, "applications/startup/.order"); - if (!ecore_file_exists(buf)) - e_prefix_data_concat_static(buf, "data/applications/startup/.order"); + e_user_dir_concat_static(buf, "applications/startup/.order"); + if (!ecore_file_exists(buf)) + e_prefix_data_concat_static(buf, "data/applications/startup/.order"); } else if (mode == E_STARTUP_RESTART) { - e_user_dir_concat_static(buf, "applications/restart/.order"); - if (!ecore_file_exists(buf)) - e_prefix_data_concat_static(buf, "data/applications/restart/.order"); + e_user_dir_concat_static(buf, "applications/restart/.order"); + if (!ecore_file_exists(buf)) + e_prefix_data_concat_static(buf, "data/applications/restart/.order"); } desktop_cache_update_handler = - ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_BUILD, - _e_startup_event_cb, - strdup(buf)); + ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_BUILD, + _e_startup_event_cb, + strdup(buf)); e_init_undone(); } @@ -49,18 +49,18 @@ _e_startup(void) if (!startup_apps) { - e_init_done(); - return; + e_init_done(); + return; } desktop = eina_list_nth(startup_apps->desktops, start_app_pos); start_app_pos++; if (!desktop) { - e_object_del(E_OBJECT(startup_apps)); - startup_apps = NULL; - start_app_pos = -1; - e_init_done(); - return; + e_object_del(E_OBJECT(startup_apps)); + startup_apps = NULL; + start_app_pos = -1; + e_init_done(); + return; } e_exec(NULL, desktop, NULL, NULL, NULL); snprintf(buf, sizeof(buf), "%s %s", _("Starting"), desktop->name); @@ -83,8 +83,9 @@ _e_startup_event_cb(void *data, int ev_type __UNUSED__, void *ev __UNUSED__) buf = data; startup_apps = e_order_new(buf); if (startup_apps) - start_app_pos = 0; + start_app_pos = 0; free(buf); _e_startup(); return ECORE_CALLBACK_PASS_ON; } +