diff options
author | James Booth <boothj5@gmail.com> | 2015-10-25 22:23:38 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-10-25 22:23:38 +0000 |
commit | 586329209465aa4ce399a0292f6f3dc353639597 (patch) | |
tree | 610986fa75ca088648483ff95da72e7bc0f9ae3a | |
parent | ea899aabee3383d5288540672d5a435a1c70c9b2 (diff) | |
download | profani-tty-586329209465aa4ce399a0292f6f3dc353639597.tar.gz |
Applied coding style to src/config/
-rw-r--r-- | src/config/preferences.c | 38 | ||||
-rw-r--r-- | src/config/preferences.h | 12 | ||||
-rw-r--r-- | src/config/theme.c | 30 | ||||
-rw-r--r-- | src/config/theme.h | 6 | ||||
-rw-r--r-- | src/config/tlscerts.c | 14 | ||||
-rw-r--r-- | src/config/tlscerts.h | 12 |
6 files changed, 57 insertions, 55 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c index 283e9158..5ac4652b 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -66,11 +66,11 @@ gint log_maxsize = 0; static Autocomplete boolean_choice_ac; static void _save_prefs(void); -static gchar * _get_preferences_file(void); -static const char * _get_group(preference_t pref); -static const char * _get_key(preference_t pref); +static gchar* _get_preferences_file(void); +static const char* _get_group(preference_t pref); +static const char* _get_key(preference_t pref); static gboolean _get_default_boolean(preference_t pref); -static char * _get_default_string(preference_t pref); +static char* _get_default_string(preference_t pref); void prefs_load(void) @@ -142,8 +142,8 @@ prefs_close(void) prefs = NULL; } -char * -prefs_autocomplete_boolean_choice(const char * const prefix) +char* +prefs_autocomplete_boolean_choice(const char *const prefix) { return autocomplete_complete(boolean_choice_ac, prefix, TRUE); } @@ -177,7 +177,7 @@ prefs_set_boolean(preference_t pref, gboolean value) _save_prefs(); } -char * +char* prefs_get_string(preference_t pref) { const char *group = _get_group(pref); @@ -263,7 +263,8 @@ prefs_set_max_log_size(gint value) _save_prefs(); } -gint prefs_get_inpblock(void) +gint +prefs_get_inpblock(void) { int val = g_key_file_get_integer(prefs, PREF_GROUP_UI, "inpblock", NULL); if (val == 0) { @@ -273,7 +274,8 @@ gint prefs_get_inpblock(void) } } -void prefs_set_inpblock(gint value) +void +prefs_set_inpblock(gint value) { g_key_file_set_integer(prefs, PREF_GROUP_UI, "inpblock", value); _save_prefs(); @@ -444,7 +446,7 @@ prefs_set_pgp_char(char ch) } gboolean -prefs_add_alias(const char * const name, const char * const value) +prefs_add_alias(const char *const name, const char *const value) { if (g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) { return FALSE; @@ -455,15 +457,15 @@ prefs_add_alias(const char * const name, const char * const value) } } -char * -prefs_get_alias(const char * const name) +char* +prefs_get_alias(const char *const name) { return g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL); } gboolean -prefs_remove_alias(const char * const name) +prefs_remove_alias(const char *const name) { if (!g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) { return FALSE; @@ -483,7 +485,7 @@ _alias_cmp(gconstpointer *p1, gconstpointer *p2) return strcmp(alias1->name, alias2->name); } -GList * +GList* prefs_get_aliases(void) { if (!g_key_file_has_group(prefs, PREF_GROUP_ALIAS)) { @@ -545,7 +547,7 @@ _save_prefs(void) g_string_free(base_str, TRUE); } -static gchar * +static gchar* _get_preferences_file(void) { gchar *xdg_config = xdg_get_config_home(); @@ -561,7 +563,7 @@ _get_preferences_file(void) // get the preference group for a specific preference // for example the PREF_BEEP setting ("beep" in .profrc, see _get_key) belongs // to the [ui] section. -static const char * +static const char* _get_group(preference_t pref) { switch (pref) @@ -648,7 +650,7 @@ _get_group(preference_t pref) // get the key used in .profrc for the preference // for example the PREF_AUTOAWAY_MODE maps to "autoaway.mode" in .profrc -static const char * +static const char* _get_key(preference_t pref) { switch (pref) @@ -833,7 +835,7 @@ _get_default_boolean(preference_t pref) // the default setting for a string type preference // if it is not specified in .profrc -static char * +static char* _get_default_string(preference_t pref) { switch (pref) diff --git a/src/config/preferences.h b/src/config/preferences.h index 46bdd550..9aa6ff72 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -124,9 +124,9 @@ typedef struct prof_alias_t { void prefs_load(void); void prefs_close(void); -char * prefs_find_login(char *prefix); +char* prefs_find_login(char *prefix); void prefs_reset_login_search(void); -char * prefs_autocomplete_boolean_choice(const char * const prefix); +char* prefs_autocomplete_boolean_choice(const char *const prefix); void prefs_reset_boolean_choice(void); gint prefs_get_gone(void); @@ -162,15 +162,15 @@ void prefs_set_pgp_char(char ch); void prefs_add_login(const char *jid); -gboolean prefs_add_alias(const char * const name, const char * const value); -gboolean prefs_remove_alias(const char * const name); -char* prefs_get_alias(const char * const name); +gboolean prefs_add_alias(const char *const name, const char *const value); +gboolean prefs_remove_alias(const char *const name); +char* prefs_get_alias(const char *const name); GList* prefs_get_aliases(void); void prefs_free_aliases(GList *aliases); gboolean prefs_get_boolean(preference_t pref); void prefs_set_boolean(preference_t pref, gboolean value); -char * prefs_get_string(preference_t pref); +char* prefs_get_string(preference_t pref); void prefs_free_string(char *pref); void prefs_set_string(preference_t pref, char *value); diff --git a/src/config/theme.c b/src/config/theme.c index 0c9a39b7..09d0fa1e 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -124,17 +124,17 @@ static struct colours_t { NCURSES_COLOR_T receiptsent; } colour_prefs; -static NCURSES_COLOR_T _lookup_colour(const char * const colour); +static NCURSES_COLOR_T _lookup_colour(const char *const colour); static void _set_colour(gchar *val, NCURSES_COLOR_T *pref, NCURSES_COLOR_T def, theme_item_t theme_item); static void _load_colours(void); static void _load_preferences(void); -static gchar * _get_themes_dir(void); -void _theme_list_dir(const gchar * const dir, GSList **result); -static GString * _theme_find(const char * const theme_name); -static gboolean _theme_load_file(const char * const theme_name); +static gchar* _get_themes_dir(void); +void _theme_list_dir(const gchar *const dir, GSList **result); +static GString* _theme_find(const char *const theme_name); +static gboolean _theme_load_file(const char *const theme_name); void -theme_init(const char * const theme_name) +theme_init(const char *const theme_name) { if (!_theme_load_file(theme_name) && !_theme_load_file("default")) { log_error("Theme initialisation failed"); @@ -144,7 +144,7 @@ theme_init(const char * const theme_name) } gboolean -theme_load(const char * const theme_name) +theme_load(const char *const theme_name) { if (_theme_load_file(theme_name)) { _load_colours(); @@ -156,7 +156,7 @@ theme_load(const char * const theme_name) } static gboolean -_theme_load_file(const char * const theme_name) +_theme_load_file(const char *const theme_name) { // use default theme if (theme_name == NULL || strcmp(theme_name, "default") == 0) { @@ -189,7 +189,7 @@ _theme_load_file(const char * const theme_name) return TRUE; } -GSList * +GSList* theme_list(void) { GSList *result = NULL; @@ -300,7 +300,7 @@ theme_init_colours(void) } static NCURSES_COLOR_T -_lookup_colour(const char * const colour) +_lookup_colour(const char *const colour) { int i; for (i = 0; i < num_colours; i++) { @@ -489,7 +489,7 @@ _load_preferences(void) } } -static gchar * +static gchar* _get_themes_dir(void) { gchar *xdg_config = xdg_get_config_home(); @@ -500,7 +500,7 @@ _get_themes_dir(void) } void -_theme_list_dir(const gchar * const dir, GSList **result) +_theme_list_dir(const gchar *const dir, GSList **result) { GDir *themes = g_dir_open(dir, 0, NULL); if (themes) { @@ -513,8 +513,8 @@ _theme_list_dir(const gchar * const dir, GSList **result) } } -static GString * -_theme_find(const char * const theme_name) +static GString* +_theme_find(const char *const theme_name) { GString *path = NULL; gchar *themes_dir = _get_themes_dir(); @@ -546,7 +546,7 @@ _theme_find(const char * const theme_name) } theme_item_t -theme_main_presence_attrs(const char * const presence) +theme_main_presence_attrs(const char *const presence) { if (g_strcmp0(presence, "online") == 0) { return THEME_ONLINE; diff --git a/src/config/theme.h b/src/config/theme.h index 2ddbb17b..59db9f57 100644 --- a/src/config/theme.h +++ b/src/config/theme.h @@ -105,12 +105,12 @@ typedef enum { THEME_MAGENTA_BOLD } theme_item_t; -void theme_init(const char * const theme_name); +void theme_init(const char *const theme_name); void theme_init_colours(void); -gboolean theme_load(const char * const theme_name); +gboolean theme_load(const char *const theme_name); GSList* theme_list(void); void theme_close(void); int theme_attrs(theme_item_t attrs); -theme_item_t theme_main_presence_attrs(const char * const presence); +theme_item_t theme_main_presence_attrs(const char *const presence); #endif diff --git a/src/config/tlscerts.c b/src/config/tlscerts.c index 3d0a0b24..17c32cb5 100644 --- a/src/config/tlscerts.c +++ b/src/config/tlscerts.c @@ -76,7 +76,7 @@ tlscerts_init(void) } gboolean -tlscerts_exists(const char * const fingerprint) +tlscerts_exists(const char *const fingerprint) { return g_key_file_has_group(tlscerts, fingerprint); } @@ -110,8 +110,8 @@ tlscerts_list(void) } TLSCertificate* -tlscerts_new(const char * const fingerprint, const char * const domain, const char * const organisation, - const char * const email, const char * const notbefore, const char * const notafter) +tlscerts_new(const char *const fingerprint, const char *const domain, const char *const organisation, + const char *const email, const char *const notbefore, const char *const notafter) { TLSCertificate *cert = malloc(sizeof(TLSCertificate)); if (fingerprint) { @@ -181,7 +181,7 @@ tlscerts_add(TLSCertificate *cert) } gboolean -tlscerts_revoke(const char * const fingerprint) +tlscerts_revoke(const char *const fingerprint) { gboolean result = g_key_file_remove_group(tlscerts, fingerprint, NULL); if (result) { @@ -193,8 +193,8 @@ tlscerts_revoke(const char * const fingerprint) return result; } -char * -tlscerts_complete(const char * const prefix) +char* +tlscerts_complete(const char *const prefix) { return autocomplete_complete(certs_ac, prefix, TRUE); } @@ -226,7 +226,7 @@ tlscerts_close(void) autocomplete_free(certs_ac); } -static gchar * +static gchar* _get_tlscerts_file(void) { gchar *xdg_data = xdg_get_data_home(); diff --git a/src/config/tlscerts.h b/src/config/tlscerts.h index b8a15c5b..dfb200b7 100644 --- a/src/config/tlscerts.h +++ b/src/config/tlscerts.h @@ -46,21 +46,21 @@ typedef struct tls_cert_t { void tlscerts_init(void); -TLSCertificate *tlscerts_new(const char * const fingerprint, const char * const domain, - const char * const organisation, const char * const email, - const char * const notbefore, const char * const notafter); +TLSCertificate* tlscerts_new(const char *const fingerprint, const char *const domain, + const char *const organisation, const char *const email, + const char *const notbefore, const char *const notafter); -gboolean tlscerts_exists(const char * const fingerprint); +gboolean tlscerts_exists(const char *const fingerprint); void tlscerts_add(TLSCertificate *cert); -gboolean tlscerts_revoke(const char * const fingerprint); +gboolean tlscerts_revoke(const char *const fingerprint); void tlscerts_free(TLSCertificate *cert); GList* tlscerts_list(void); -char* tlscerts_complete(const char * const prefix); +char* tlscerts_complete(const char *const prefix); void tlscerts_reset_ac(void); |