summaryrefslogtreecommitdiffstats
path: root/source/helper.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2020-02-02 13:56:37 +0100
committerDave Davenport <qball@gmpclient.org>2020-02-02 13:56:37 +0100
commitb1692899969b89b8478e403957e266437e07d9e9 (patch)
tree0b2a7665e151e3ffe2f8ce8c32f2e3ad2f0aac91 /source/helper.c
parent83c2e467d5b34f9e74e2c55b1e9df2b715be175e (diff)
Indent all the code.
Diffstat (limited to 'source/helper.c')
-rw-r--r--source/helper.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/source/helper.c b/source/helper.c
index 02bddc29..071da9bd 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -79,7 +79,6 @@ void cmd_set_arguments ( int argc, char **argv )
stored_argv = argv;
}
-
int helper_parse_setup ( char * string, char ***output, int *length, ... )
{
GError *error = NULL;
@@ -433,8 +432,8 @@ PangoAttrList *helper_token_match_get_pango_attr ( RofiHighlightColorStyle th, r
pa->end_index = end;
pango_attr_list_insert ( retv, pa );
- if ( th.color.alpha < 1.0 ){
- pa = pango_attr_foreground_alpha_new(th.color.alpha*65535);
+ if ( th.color.alpha < 1.0 ) {
+ pa = pango_attr_foreground_alpha_new ( th.color.alpha * 65535 );
pa->start_index = start;
pa->end_index = end;
pango_attr_list_insert ( retv, pa );
@@ -1135,12 +1134,13 @@ cairo_surface_t* cairo_image_surface_create_from_svg ( const gchar* file, int he
static void parse_pair ( char *input, rofi_range_pair *item )
{
// Skip leading blanks.
- while ( input != NULL && isblank(*input) )
+ while ( input != NULL && isblank ( *input ) ) {
++input;
+ }
- const char *sep[] = { "-", ":" };
- int pythonic = ( strchr(input, ':') || input[0] == '-' ) ? 1 : 0;
- int index = 0;
+ const char *sep[] = { "-", ":" };
+ int pythonic = ( strchr ( input, ':' ) || input[0] == '-' ) ? 1 : 0;
+ int index = 0;
for ( char *token = strsep ( &input, sep[pythonic] ); token != NULL; token = strsep ( &input, sep[pythonic] ) ) {
if ( index == 0 ) {
@@ -1208,12 +1208,13 @@ void rofi_output_formatted_line ( const char *format, const char *string, int se
}
else if ( format[i] == 'p' ) {
char *esc = NULL;
- pango_parse_markup(string, -1, 0, NULL, &esc, NULL, NULL);
- if ( esc ){
+ pango_parse_markup ( string, -1, 0, NULL, &esc, NULL, NULL );
+ if ( esc ) {
fputs ( esc, stdout );
g_free ( esc );
- } else {
- fputs ( "invalid string" , stdout );
+ }
+ else {
+ fputs ( "invalid string", stdout );
}
}
else if ( format[i] == 'q' ) {
@@ -1241,15 +1242,14 @@ void rofi_output_formatted_line ( const char *format, const char *string, int se
fflush ( stdout );
}
-
static gboolean helper_eval_cb2 ( const GMatchInfo *info, GString *res, gpointer data )
{
gchar *match;
// Get the match
- int num_match = g_match_info_get_match_count(info);
+ int num_match = g_match_info_get_match_count ( info );
// Just {text} This is inside () 5.
if ( num_match == 5 ) {
- match = g_match_info_fetch ( info, 4);
+ match = g_match_info_fetch ( info, 4 );
if ( match != NULL ) {
// Lookup the match, so we can replace it.
gchar *r = g_hash_table_lookup ( (GHashTable *) data, match );
@@ -1263,21 +1263,21 @@ static gboolean helper_eval_cb2 ( const GMatchInfo *info, GString *res, gpointer
}
// {} with [] guard around it.
else if ( num_match == 4 ) {
- match = g_match_info_fetch ( info, 2);
+ match = g_match_info_fetch ( info, 2 );
if ( match != NULL ) {
// Lookup the match, so we can replace it.
gchar *r = g_hash_table_lookup ( (GHashTable *) data, match );
if ( r != NULL ) {
// Add (optional) prefix
- gchar *prefix = g_match_info_fetch (info, 1);
+ gchar *prefix = g_match_info_fetch ( info, 1 );
g_string_append ( res, prefix );
- g_free (prefix );
+ g_free ( prefix );
// Append the replacement to the string.
g_string_append ( res, r );
// Add (optional) postfix
- gchar *post = g_match_info_fetch (info, 3);
+ gchar *post = g_match_info_fetch ( info, 3 );
g_string_append ( res, post );
- g_free (post );
+ g_free ( post );
}
// Free match.
g_free ( match );
@@ -1292,7 +1292,7 @@ char *helper_string_replace_if_exists ( char * string, ... )
{
GHashTable *h;
h = g_hash_table_new ( g_str_hash, g_str_equal );
- va_list ap;
+ va_list ap;
va_start ( ap, string );
// Add list from variable arguments.
while ( 1 ) {
@@ -1324,12 +1324,12 @@ char *helper_string_replace_if_exists ( char * string, ... )
*/
char *helper_string_replace_if_exists_v ( char * string, GHashTable *h )
{
- GError *error = NULL;
- char *res = NULL;
+ GError *error = NULL;
+ char *res = NULL;
// Replace hits within {-\w+}.
GRegex *reg = g_regex_new ( "\\[(.*)({[-\\w]+})(.*)\\]|({[\\w-]+})", 0, 0, &error );
- if ( error == NULL ){
+ if ( error == NULL ) {
res = g_regex_replace_eval ( reg, string, -1, 0, 0, helper_eval_cb2, h, &error );
}
// Free regex.