summaryrefslogtreecommitdiffstats
path: root/source/dialogs
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-02-03 20:49:16 +0100
committerDave Davenport <qball@gmpclient.org>2017-02-03 20:49:16 +0100
commit8ef7b4b794d36013969dcda1b9f6b1fb15d97f60 (patch)
treec24ae261cdad70af03fb968d351e6a205356bf6c /source/dialogs
parent2fe22cb7e2ee6f914774c7cc569911e9c9dc070c (diff)
Don't recreate every string everytime.
Diffstat (limited to 'source/dialogs')
-rw-r--r--source/dialogs/combi.c18
-rw-r--r--source/dialogs/dmenu.c8
-rw-r--r--source/dialogs/drun.c16
3 files changed, 21 insertions, 21 deletions
diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c
index f63c49bf..09b180aa 100644
--- a/source/dialogs/combi.c
+++ b/source/dialogs/combi.c
@@ -154,13 +154,13 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
CombiModePrivateData *pd = mode_get_private_data ( sw );
if ( input[0][0] == '!' ) {
- int switcher = -1;
- char *eob = strchrnul ( input[0], ' ' );
+ int switcher = -1;
+ char *eob = strchrnul ( input[0], ' ' );
ssize_t bang_len = g_utf8_pointer_to_offset ( input[0], eob ) - 1;
if ( bang_len > 0 ) {
for ( unsigned i = 0; switcher == -1 && i < pd->num_switchers; i++ ) {
- const char *mode_name = mode_get_name ( pd->switchers[i] );
- size_t mode_name_len = g_utf8_strlen ( mode_name, -1 );
+ const char *mode_name = mode_get_name ( pd->switchers[i] );
+ size_t mode_name_len = g_utf8_strlen ( mode_name, -1 );
if ( (size_t) bang_len <= mode_name_len && utf8_strncmp ( &input[0][1], mode_name, bang_len ) == 0 ) {
switcher = i;
}
@@ -168,7 +168,7 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
}
if ( switcher >= 0 ) {
if ( eob[0] == ' ' ) {
- char *n = eob+1;
+ char *n = eob + 1;
return mode_result ( pd->switchers[switcher], mretv, &n,
selected_line - pd->starts[switcher] );
}
@@ -244,18 +244,18 @@ static char * combi_preprocess_input ( Mode *sw, const char *input )
CombiModePrivateData *pd = mode_get_private_data ( sw );
pd->current = NULL;
if ( input != NULL && input[0] == '!' ) {
- char *eob = strchrnul ( input, ' ' );
+ char *eob = strchrnul ( input, ' ' );
ssize_t bang_len = g_utf8_pointer_to_offset ( input, eob ) - 1;
if ( bang_len > 0 ) {
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
- const char *mode_name = mode_get_name ( pd->switchers[i] );
- size_t mode_name_len = g_utf8_strlen ( mode_name, -1 );
+ const char *mode_name = mode_get_name ( pd->switchers[i] );
+ size_t mode_name_len = g_utf8_strlen ( mode_name, -1 );
if ( (size_t) bang_len <= mode_name_len && utf8_strncmp ( &input[1], mode_name, bang_len ) == 0 ) {
pd->current = pd->switchers[i];
if ( eob[0] == '\0' || eob[1] == '\0' ) {
return NULL;
}
- return g_strdup ( eob+1 );
+ return g_strdup ( eob + 1 );
}
}
}
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c
index 63e5a189..026f065e 100644
--- a/source/dialogs/dmenu.c
+++ b/source/dialogs/dmenu.c
@@ -158,7 +158,7 @@ static void async_read_callback ( GObject *source_object, GAsyncResult *res, gpo
}
if ( !g_cancellable_is_cancelled ( pd->cancel ) ) {
// Hack, don't use get active.
- g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Clearing overlay");
+ g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Clearing overlay" );
rofi_view_set_overlay ( rofi_view_get_active (), NULL );
g_input_stream_close_async ( G_INPUT_STREAM ( stream ), G_PRIORITY_LOW, pd->cancel, async_close_callback, pd );
}
@@ -171,7 +171,7 @@ static void async_read_cancel ( G_GNUC_UNUSED GCancellable *cancel, G_GNUC_UNUSE
static int get_dmenu_async ( DmenuModePrivateData *pd, int sync_pre_read )
{
- while(sync_pre_read-- ){
+ while ( sync_pre_read-- ) {
gsize len = 0;
char *data = g_data_input_stream_read_upto ( pd->data_input_stream, &( pd->separator ), 1, &len, NULL, NULL );
if ( data == NULL ) {
@@ -636,7 +636,7 @@ int dmenu_switcher_dialog ( void )
}
if ( async ) {
unsigned int pre_read = 25;
- find_arg_uint("-async-pre-read", &pre_read);
+ find_arg_uint ( "-async-pre-read", &pre_read );
async = get_dmenu_async ( pd, pre_read );
}
else {
@@ -728,5 +728,5 @@ void print_dmenu_options ( void )
print_help_msg ( "-sep", "[char]", "Element separator.", "'\\n'", is_term );
print_help_msg ( "-input", "[filename]", "Read input from file instead from standard input.", NULL, is_term );
print_help_msg ( "-sync", "", "Force dmenu to first read all input data, then show dialog.", NULL, is_term );
- print_help_msg ( "-async-pre-read", "[number]", "Read several entries blocking before switching to async mode", "25", is_term);
+ print_help_msg ( "-async-pre-read", "[number]", "Read several entries blocking before switching to async mode", "25", is_term );
}
diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c
index 7a3a60b1..fa10c863 100644
--- a/source/dialogs/drun.c
+++ b/source/dialogs/drun.c
@@ -87,17 +87,17 @@ static inline int execsh ( const char *wd, const char *cmd, int run_in_term )
typedef struct
{
/* Root */
- char *root;
+ char *root;
/* Path to desktop file */
- char *path;
+ char *path;
/* Executable */
- char *exec;
+ char *exec;
/* Name of the Entry */
- char *name;
+ char *name;
/* Generic Name */
- char *generic_name;
+ char *generic_name;
- GKeyFile *key_file;
+ GKeyFile *key_file;
} DRunModeEntry;
typedef struct
@@ -288,8 +288,8 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
}
size_t nl = ( ( pd->cmd_list_length ) + 1 );
if ( nl >= pd->cmd_list_length_actual ) {
- pd->cmd_list_length_actual+=256;
- pd->entry_list = g_realloc ( pd->entry_list, pd->cmd_list_length_actual * sizeof ( *( pd->entry_list ) ) );
+ pd->cmd_list_length_actual += 256;
+ pd->entry_list = g_realloc ( pd->entry_list, pd->cmd_list_length_actual * sizeof ( *( pd->entry_list ) ) );
}
pd->entry_list[pd->cmd_list_length].root = g_strdup ( root );
pd->entry_list[pd->cmd_list_length].path = g_strdup ( path );