diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-07-31 23:28:31 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-07-31 23:28:31 +0200 |
commit | 604b4cb6192192a0ce68b1a24a630e9775134fb1 (patch) | |
tree | 613d2df08500715408ab16f95e53707f73ffba41 | |
parent | 4ad2c37eeafd04526ac785d0b136dc7483534d28 (diff) |
Fix memory leak, re-indent
-rw-r--r-- | include/textbox.h | 20 | ||||
-rw-r--r-- | source/dialogs/ssh.c | 2 | ||||
-rw-r--r-- | source/dialogs/window.c | 1 | ||||
-rw-r--r-- | source/helper.c | 2 | ||||
-rw-r--r-- | source/rofi.c | 36 | ||||
-rw-r--r-- | source/textbox.c | 8 |
6 files changed, 35 insertions, 34 deletions
diff --git a/include/textbox.h b/include/textbox.h index 3109f577..88894ed9 100644 --- a/include/textbox.h +++ b/include/textbox.h @@ -39,16 +39,16 @@ typedef struct typedef enum { - TB_AUTOHEIGHT = 1 << 0, - TB_AUTOWIDTH = 1 << 1, - TB_LEFT = 1 << 16, - TB_RIGHT = 1 << 17, - TB_CENTER = 1 << 18, - TB_EDITABLE = 1 << 19, - TB_MARKUP = 1 << 20, - TB_WRAP = 1 << 21, - TB_PASSWORD = 1 << 22, - TB_INDICATOR = 1 << 23, + TB_AUTOHEIGHT = 1 << 0, + TB_AUTOWIDTH = 1 << 1, + TB_LEFT = 1 << 16, + TB_RIGHT = 1 << 17, + TB_CENTER = 1 << 18, + TB_EDITABLE = 1 << 19, + TB_MARKUP = 1 << 20, + TB_WRAP = 1 << 21, + TB_PASSWORD = 1 << 22, + TB_INDICATOR = 1 << 23, } TextboxFlags; typedef enum diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index 397893dc..f11ba3a1 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length ) // Reading one line per time. while ( getline ( &buffer, &buffer_length, fd ) > 0 ) { // Evaluate one line. - unsigned int index = 0, ti = 0; + unsigned int index = 0, ti = 0; char *token = buffer; // Tokenize it. diff --git a/source/dialogs/window.c b/source/dialogs/window.c index bd553fc3..825875ae 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -672,6 +672,7 @@ static gboolean helper_eval_cb ( const GMatchInfo *info, GString *str, gpointer else if ( match[1] == 'r' ) { helper_eval_add_str ( str, d->c->role, l, d->pd->role_len ); } + g_free ( match ); } return FALSE; } diff --git a/source/helper.c b/source/helper.c index 684256f8..4c0f5bca 100644 --- a/source/helper.c +++ b/source/helper.c @@ -197,7 +197,7 @@ GRegex **tokenize ( const char *input, int case_sensitive ) } char *saveptr = NULL, *token; - GRegex **retv = NULL; + GRegex **retv = NULL; if ( !config.tokenize ) { retv = g_malloc0 ( sizeof ( GRegex* ) * 2 ); retv[0] = (GRegex *) create_regex ( input, case_sensitive ); diff --git a/source/rofi.c b/source/rofi.c index 74b2f5f6..af19c87c 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -74,9 +74,9 @@ struct xkb_stuff xkb = { .keymap = NULL, .state = NULL, .compose = { - .table = NULL, - .state = NULL - } + .table = NULL, + .state = NULL +} }; char *config_path = NULL; // Array of modi. @@ -441,22 +441,22 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id ); break; case XCB_XKB_STATE_NOTIFY: - { - xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev; - guint modmask; - xkb_state_update_mask ( xkb.state, - ksne->baseMods, - ksne->latchedMods, - ksne->lockedMods, - ksne->baseGroup, - ksne->latchedGroup, - ksne->lockedGroup ); - modmask = x11_get_current_mask ( &xkb ); - if ( modmask == 0 ) { - abe_trigger_release ( ); + { + xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev; + guint modmask; + xkb_state_update_mask ( xkb.state, + ksne->baseMods, + ksne->latchedMods, + ksne->lockedMods, + ksne->baseGroup, + ksne->latchedGroup, + ksne->lockedGroup ); + modmask = x11_get_current_mask ( &xkb ); + if ( modmask == 0 ) { + abe_trigger_release ( ); + } + break; } - break; - } } return G_SOURCE_CONTINUE; } diff --git a/source/textbox.c b/source/textbox.c index 5b9e76f2..302be539 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -54,9 +54,9 @@ typedef struct } RowColor; #define num_states 3 -RowColor colors[num_states]; +RowColor colors[num_states]; -static PangoContext *p_context = NULL; +static PangoContext *p_context = NULL; static PangoFontMetrics *p_metrics = NULL; static gboolean textbox_blink ( gpointer data ) { @@ -732,12 +732,12 @@ int textbox_get_font_width ( textbox *tb ) double textbox_get_estimated_char_width ( void ) { - int width = pango_font_metrics_get_approximate_char_width ( p_metrics ); + int width = pango_font_metrics_get_approximate_char_width ( p_metrics ); return ( width ) / (double) PANGO_SCALE; } int textbox_get_estimated_char_height ( void ) { - int height = pango_font_metrics_get_ascent ( p_metrics ) + pango_font_metrics_get_descent ( p_metrics ); + int height = pango_font_metrics_get_ascent ( p_metrics ) + pango_font_metrics_get_descent ( p_metrics ); return ( height ) / PANGO_SCALE + 2 * SIDE_MARGIN; } |