aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-08-17 00:08:19 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-08-17 00:13:05 +0200
commit1613e75a4809dd7d37c5b70cbb48d0d6d728c118 (patch)
tree9fdeac0d9a08f3b5bd635328a6920c463151b143 /degesch.c
parentabd892cbd7d09086c7c3d45ba6bc53ed95176d3b (diff)
downloadxK-1613e75a4809dd7d37c5b70cbb48d0d6d728c118.tar.gz
xK-1613e75a4809dd7d37c5b70cbb48d0d6d728c118.tar.xz
xK-1613e75a4809dd7d37c5b70cbb48d0d6d728c118.zip
mv 'struct config_item'{_,}
Finally we can get rid of the trailing underscore.
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/degesch.c b/degesch.c
index 875eead..3896d74 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1112,7 +1112,7 @@ struct server
char *name; ///< Server identifier
struct buffer *buffer; ///< The buffer for this server
- struct config_item_ *config; ///< Configuration root
+ struct config_item *config; ///< Configuration root
// Connection:
@@ -1473,25 +1473,25 @@ static void refresh_prompt (struct app_context *ctx);
// --- Configuration -----------------------------------------------------------
static void
-on_config_debug_mode_change (struct config_item_ *item)
+on_config_debug_mode_change (struct config_item *item)
{
g_debug_mode = item->value.boolean;
}
static void
-on_config_show_all_prefixes_change (struct config_item_ *item)
+on_config_show_all_prefixes_change (struct config_item *item)
{
struct app_context *ctx = item->user_data;
ctx->show_all_prefixes = item->value.boolean;
refresh_prompt (ctx);
}
-static void on_config_attribute_change (struct config_item_ *item);
-static void on_config_logging_change (struct config_item_ *item);
+static void on_config_attribute_change (struct config_item *item);
+static void on_config_logging_change (struct config_item *item);
#define TRIVIAL_BOOLEAN_ON_CHANGE(name) \
static void \
- on_config_ ## name ## _change (struct config_item_ *item) \
+ on_config_ ## name ## _change (struct config_item *item) \
{ \
struct app_context *ctx = item->user_data; \
ctx->name = item->value.boolean; \
@@ -1504,7 +1504,7 @@ TRIVIAL_BOOLEAN_ON_CHANGE (beep_on_highlight)
static bool
config_validate_nonjunk_string
- (const struct config_item_ *item, struct error **e)
+ (const struct config_item *item, struct error **e)
{
if (item->type == CONFIG_ITEM_NULL)
return true;
@@ -1525,7 +1525,7 @@ config_validate_nonjunk_string
static bool
config_validate_addresses
- (const struct config_item_ *item, struct error **e)
+ (const struct config_item *item, struct error **e)
{
if (item->type == CONFIG_ITEM_NULL)
return true;
@@ -1548,7 +1548,7 @@ config_validate_addresses
static bool
config_validate_nonnegative
- (const struct config_item_ *item, struct error **e)
+ (const struct config_item *item, struct error **e)
{
if (item->type == CONFIG_ITEM_NULL)
return true;
@@ -1722,13 +1722,13 @@ static struct config_schema g_config_attributes[] =
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void
-load_config_behaviour (struct config_item_ *subtree, void *user_data)
+load_config_behaviour (struct config_item *subtree, void *user_data)
{
config_schema_apply_to_object (g_config_behaviour, subtree, user_data);
}
static void
-load_config_attributes (struct config_item_ *subtree, void *user_data)
+load_config_attributes (struct config_item *subtree, void *user_data)
{
config_schema_apply_to_object (g_config_attributes, subtree, user_data);
}
@@ -1747,9 +1747,9 @@ register_config_modules (struct app_context *ctx)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static const char *
-get_config_string (struct config_item_ *root, const char *key)
+get_config_string (struct config_item *root, const char *key)
{
- struct config_item_ *item = config_item_get (root, key, NULL);
+ struct config_item *item = config_item_get (root, key, NULL);
hard_assert (item);
if (item->type == CONFIG_ITEM_NULL)
return NULL;
@@ -1759,12 +1759,12 @@ get_config_string (struct config_item_ *root, const char *key)
static bool
set_config_string
- (struct config_item_ *root, const char *key, const char *value)
+ (struct config_item *root, const char *key, const char *value)
{
- struct config_item_ *item = config_item_get (root, key, NULL);
+ struct config_item *item = config_item_get (root, key, NULL);
hard_assert (item);
- struct config_item_ *new_ = config_item_string_from_cstr (value);
+ struct config_item *new_ = config_item_string_from_cstr (value);
struct error *e = NULL;
if (config_item_set_from (item, new_, &e))
return true;
@@ -1776,17 +1776,17 @@ set_config_string
}
static int64_t
-get_config_integer (struct config_item_ *root, const char *key)
+get_config_integer (struct config_item *root, const char *key)
{
- struct config_item_ *item = config_item_get (root, key, NULL);
+ struct config_item *item = config_item_get (root, key, NULL);
hard_assert (item && item->type == CONFIG_ITEM_INTEGER);
return item->value.integer;
}
static bool
-get_config_boolean (struct config_item_ *root, const char *key)
+get_config_boolean (struct config_item *root, const char *key)
{
- struct config_item_ *item = config_item_get (root, key, NULL);
+ struct config_item *item = config_item_get (root, key, NULL);
hard_assert (item && item->type == CONFIG_ITEM_BOOLEAN);
return item->value.boolean;
}
@@ -2020,7 +2020,7 @@ log_message_attributed (void *user_data, const char *quote, const char *fmt,
}
static void
-apply_attribute_change (struct config_item_ *item, int id)
+apply_attribute_change (struct config_item *item, int id)
{
struct app_context *ctx = item->user_data;
free (ctx->attrs[id]);
@@ -2030,7 +2030,7 @@ apply_attribute_change (struct config_item_ *item, int id)
}
static void
-on_config_attribute_change (struct config_item_ *item)
+on_config_attribute_change (struct config_item *item)
{
static const char *table[ATTR_COUNT] =
{
@@ -3055,7 +3055,7 @@ buffer_close_log_file (struct buffer *buffer)
}
static void
-on_config_logging_change (struct config_item_ *item)
+on_config_logging_change (struct config_item *item)
{
struct app_context *ctx = item->user_data;
ctx->logging = item->value.boolean;
@@ -6737,11 +6737,11 @@ struct config_dump_data
};
static void config_dump_item
- (struct config_item_ *item, struct config_dump_data *data);
+ (struct config_item *item, struct config_dump_data *data);
static void
config_dump_children
- (struct config_item_ *object, struct config_dump_data *data)
+ (struct config_item *object, struct config_dump_data *data)
{
hard_assert (object->type == CONFIG_ITEM_OBJECT);
@@ -6754,7 +6754,7 @@ config_dump_children
struct str_map_iter iter;
str_map_iter_init (&iter, &object->value.object);
- struct config_item_ *child;
+ struct config_item *child;
while ((child = str_map_iter_next (&iter)))
{
level.name = iter.link->key;
@@ -6766,7 +6766,7 @@ config_dump_children
}
static void
-config_dump_item (struct config_item_ *item, struct config_dump_data *data)
+config_dump_item (struct config_item *item, struct config_dump_data *data)
{
// Empty objects will show as such
if (item->type == CONFIG_ITEM_OBJECT
@@ -6817,7 +6817,7 @@ config_dump_item (struct config_item_ *item, struct config_dump_data *data)
}
static void
-config_dump (struct config_item_ *root, struct str_vector *output)
+config_dump (struct config_item *root, struct str_vector *output)
{
struct config_dump_data data;
data.head = NULL;
@@ -6908,7 +6908,7 @@ check_server_name_for_addition (struct app_context *ctx, const char *name)
static struct server *
server_add (struct app_context *ctx,
- const char *name, struct config_item_ *subtree)
+ const char *name, struct config_item *subtree)
{
hard_assert (!str_map_find (&ctx->servers, name));
@@ -6947,7 +6947,7 @@ server_add_new (struct app_context *ctx, const char *name)
// of manual edits to the configuration, though, and they're not really
// going to break anything. They only cause surprises when loading.
struct str_map *servers = get_servers_config (ctx);
- struct config_item_ *subtree = config_item_object ();
+ struct config_item *subtree = config_item_object ();
str_map_set (servers, name, subtree);
struct server *s = server_add (ctx, name, subtree);
@@ -7259,7 +7259,7 @@ handle_command_buffer (struct handler_args *a)
static bool
replace_string_array
- (struct config_item_ *item, struct str_vector *array, struct error **e)
+ (struct config_item *item, struct str_vector *array, struct error **e)
{
char *changed = join_str_vector (array, ',');
struct str tmp = { .str = changed, .len = strlen (changed) };
@@ -7271,7 +7271,7 @@ replace_string_array
static bool
handle_command_set_add
- (struct config_item_ *item, const char *value, struct error **e)
+ (struct config_item *item, const char *value, struct error **e)
{
bool result = false;
struct str_vector items;
@@ -7294,7 +7294,7 @@ handle_command_set_add
static bool
handle_command_set_remove
- (struct config_item_ *item, const char *value, struct error **e)
+ (struct config_item *item, const char *value, struct error **e)
{
bool result = false;
struct str_vector items;
@@ -7318,9 +7318,9 @@ handle_command_set_remove
static void
handle_command_set_assign_item (struct app_context *ctx,
- char *key, struct config_item_ *new_, bool add, bool remove)
+ char *key, struct config_item *new_, bool add, bool remove)
{
- struct config_item_ *item =
+ struct config_item *item =
config_item_get (ctx->config.root, key, NULL);
hard_assert (item);
@@ -7369,7 +7369,7 @@ handle_command_set_assign
return false;
struct error *e = NULL;
- struct config_item_ *new_ =
+ struct config_item *new_ =
config_item_parse (arguments, strlen (arguments), true, &e);
if (e)
{
@@ -7447,7 +7447,7 @@ show_aliases_list (struct app_context *ctx)
struct str_map_iter iter;
str_map_iter_init (&iter, aliases);
- struct config_item_ *alias;
+ struct config_item *alias;
while ((alias = str_map_iter_next (&iter)))
{
struct str definition;
@@ -7473,7 +7473,7 @@ handle_command_alias (struct handler_args *a)
if (!*a->arguments)
return false;
- struct config_item_ *alias = config_item_string_from_cstr (a->arguments);
+ struct config_item *alias = config_item_string_from_cstr (a->arguments);
struct str definition;
str_init (&definition);
@@ -8263,7 +8263,7 @@ g_command_handlers[] =
static bool
try_handle_command_help_option (struct app_context *ctx, const char *name)
{
- struct config_item_ *item =
+ struct config_item *item =
config_item_get (ctx->config.root, name, NULL);
if (!item)
return false;
@@ -8465,7 +8465,7 @@ static bool
expand_alias (struct app_context *ctx,
const char *alias_name, char *input, struct str_vector *commands)
{
- struct config_item_ *entry =
+ struct config_item *entry =
str_map_find (get_aliases_config (ctx), alias_name);
if (!entry)
return false;
@@ -8715,7 +8715,7 @@ complete_command (struct app_context *ctx, struct completion *data,
struct str_map_iter iter;
str_map_iter_init (&iter, get_aliases_config (ctx));
- struct config_item_ *alias;
+ struct config_item *alias;
while ((alias = str_map_iter_next (&iter)))
{
if (!strncasecmp_ascii (word, iter.link->key, word_len))
@@ -9470,10 +9470,10 @@ read_file (const char *filename, struct str *output, struct error **e)
return false;
}
-static struct config_item_ *
+static struct config_item *
load_configuration_file (const char *filename, struct error **e)
{
- struct config_item_ *root = NULL;
+ struct config_item *root = NULL;
struct str data;
str_init (&data);
@@ -9544,7 +9544,7 @@ load_default_aliases (struct app_context *ctx)
static void
load_configuration (struct app_context *ctx)
{
- struct config_item_ *root = NULL;
+ struct config_item *root = NULL;
struct error *e = NULL;
char *filename = resolve_filename
@@ -9587,7 +9587,7 @@ load_servers (struct app_context *ctx)
struct str_map_iter iter;
str_map_iter_init (&iter, get_servers_config (ctx));
- struct config_item_ *subtree;
+ struct config_item *subtree;
while ((subtree = str_map_iter_next (&iter)))
{
const char *name = iter.link->key;