Fix memory leak, re-indent

This commit is contained in:
Dave Davenport 2016-07-31 23:28:31 +02:00
parent 4ad2c37eea
commit 604b4cb619
6 changed files with 35 additions and 34 deletions

View File

@ -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

View File

@ -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.

View File

@ -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;
}

View File

@ -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 );

View File

@ -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;
}

View File

@ -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;
}