diff --git a/include/textbox.h b/include/textbox.h index a7619f7d..455904f8 100644 --- a/include/textbox.h +++ b/include/textbox.h @@ -39,15 +39,15 @@ 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_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, } TextboxFlags; typedef enum diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index 9cc75543..331e5431 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/helper.c b/source/helper.c index 88fed23b..f5fd027e 100644 --- a/source/helper.c +++ b/source/helper.c @@ -163,7 +163,7 @@ static gchar *glob_to_regex ( const char *input ) } static GRegex * create_regex ( const char *input, int case_sensitive ) { -#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), G_REGEX_MATCH_PARTIAL, NULL ) +#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL ) GRegex *retv = NULL; if ( config.glob ) { gchar *r = glob_to_regex ( input ); @@ -196,7 +196,11 @@ static GRegex * create_regex ( const char *input, int case_sensitive ) } GRegex **tokenize ( const char *input, int case_sensitive ) { - if ( input == NULL || strlen ( input ) == 0 ) { + if ( input == NULL ) { + return NULL; + } + size_t len = strlen ( input ); + if ( len == 0 ) { return NULL; } @@ -365,7 +369,7 @@ int token_match ( GRegex **tokens, const char *input ) // Do a tokenized match. if ( tokens ) { for ( int j = 0; match && tokens[j]; j++ ) { - match = g_regex_match ( (GRegex *) tokens[j], input, G_REGEX_MATCH_PARTIAL, NULL ); + match = g_regex_match ( (GRegex *) tokens[j], input, 0, NULL ); } } return match; diff --git a/source/rofi.c b/source/rofi.c index 02eef1fd..d4fadc6d 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 ( ); - } - break; + { + 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; + } } return G_SOURCE_CONTINUE; } diff --git a/source/view.c b/source/view.c index f88259f0..59ad874a 100644 --- a/source/view.c +++ b/source/view.c @@ -496,10 +496,10 @@ static void filter_elements ( thread_state *t, G_GNUC_UNUSED gpointer user_data t->state->line_map[t->start + t->count] = i; if ( config.levenshtein_sort ) { // This is inefficient, need to fix it. - char * str = mode_get_completion ( t->state->sw, i ); + char * str = mode_get_completion ( t->state->sw, i ); char * input = mode_preprocess_input ( t->state->sw, t->state->text->text ); t->state->distance[i] = levenshtein ( input, str ); - g_free(input); + g_free ( input ); g_free ( str ); } t->count++; @@ -926,9 +926,9 @@ static void rofi_view_draw ( RofiViewState *state, cairo_t *d ) int x_offset = state->border; if ( state->rchanged ) { - char *input = mode_preprocess_input ( state->sw, state->text->text ); + char *input = mode_preprocess_input ( state->sw, state->text->text ); GRegex **tokens = tokenize ( input, config.case_sensitive ); - g_free(input); + g_free ( input ); // Move, resize visible boxes and show them. for ( i = 0; i < max_elements && ( i + offset ) < state->filtered_lines; i++ ) { unsigned int ex = ( ( i ) / state->max_rows ) * ( element_width + config.line_margin );