diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-07-16 03:03:11 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-07-16 04:34:40 +0200 |
commit | e9f3d2d508bfd9fb5b54e82994bda365a71eb864 (patch) | |
tree | 5cbc33e5f3b497641e5c8818ced20feb8c94780b | |
parent | journal-remote: allow splitting incoming logs by source host (diff) | |
download | systemd-e9f3d2d508bfd9fb5b54e82994bda365a71eb864.tar.xz systemd-e9f3d2d508bfd9fb5b54e82994bda365a71eb864.zip |
Constify ConfigTableItem tables
Diffstat (limited to '')
-rw-r--r-- | src/bootchart/bootchart.c | 2 | ||||
-rw-r--r-- | src/core/load-dropin.c | 2 | ||||
-rw-r--r-- | src/core/load-fragment.c | 2 | ||||
-rw-r--r-- | src/core/main.c | 2 | ||||
-rw-r--r-- | src/dbus1-generator/dbus1-generator.c | 2 | ||||
-rw-r--r-- | src/journal/coredump.c | 2 | ||||
-rw-r--r-- | src/journal/journald-server.c | 2 | ||||
-rw-r--r-- | src/login/logind.c | 2 | ||||
-rw-r--r-- | src/network/networkd-netdev.c | 2 | ||||
-rw-r--r-- | src/network/networkd-network.c | 6 | ||||
-rw-r--r-- | src/resolve/resolved-manager.c | 5 | ||||
-rw-r--r-- | src/shared/conf-parser.c | 12 | ||||
-rw-r--r-- | src/shared/conf-parser.h | 8 | ||||
-rw-r--r-- | src/shared/install.c | 2 | ||||
-rw-r--r-- | src/shared/sleep-config.c | 2 | ||||
-rw-r--r-- | src/timesync/timesyncd.c | 2 | ||||
-rw-r--r-- | src/tty-ask-password-agent/tty-ask-password-agent.c | 2 | ||||
-rw-r--r-- | src/udev/net/link-config.c | 6 |
18 files changed, 33 insertions, 30 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c index 01a5bf18ef..8e849da59c 100644 --- a/src/bootchart/bootchart.c +++ b/src/bootchart/bootchart.c @@ -132,7 +132,7 @@ static void parse_conf(void) { return; r = config_parse(NULL, BOOTCHART_CONF, f, - NULL, config_item_table_lookup, (void*) items, true, false, NULL); + NULL, config_item_table_lookup, items, true, false, NULL); if (r < 0) log_warning("Failed to parse configuration file: %s", strerror(-r)); diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index 6ff592be8b..66547cf4bc 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -187,7 +187,7 @@ int unit_load_dropin(Unit *u) { STRV_FOREACH(f, u->dropin_paths) { config_parse(u->id, *f, NULL, UNIT_VTABLE(u)->sections, config_item_perf_lookup, - (void*) load_fragment_gperf_lookup, false, false, u); + load_fragment_gperf_lookup, false, false, u); } u->dropin_mtime = now(CLOCK_REALTIME); diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index b6894d22ae..54010b804e 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3370,7 +3370,7 @@ static int load_from_path(Unit *u, const char *path) { /* Now, parse the file contents */ r = config_parse(u->id, filename, f, UNIT_VTABLE(u)->sections, config_item_perf_lookup, - (void*) load_fragment_gperf_lookup, false, true, u); + load_fragment_gperf_lookup, false, true, u); if (r < 0) return r; } diff --git a/src/core/main.c b/src/core/main.c index a21a959be9..d1fb265df1 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -696,7 +696,7 @@ static int parse_config_file(void) { return 0; } - r = config_parse(NULL, fn, f, "Manager\0", config_item_table_lookup, (void*) items, false, false, NULL); + r = config_parse(NULL, fn, f, "Manager\0", config_item_table_lookup, items, false, false, NULL); if (r < 0) log_warning("Failed to parse configuration file: %s", strerror(-r)); diff --git a/src/dbus1-generator/dbus1-generator.c b/src/dbus1-generator/dbus1-generator.c index 95962c73c1..ba2953014d 100644 --- a/src/dbus1-generator/dbus1-generator.c +++ b/src/dbus1-generator/dbus1-generator.c @@ -156,7 +156,7 @@ static int create_dbus_files( static int add_dbus(const char *path, const char *fname, const char *type) { _cleanup_free_ char *name = NULL, *exec = NULL, *user = NULL, *service = NULL; - ConfigTableItem table[] = { + const ConfigTableItem table[] = { { "D-BUS Service", "Name", config_parse_string, 0, &name }, { "D-BUS Service", "Exec", config_parse_string, 0, &exec }, { "D-BUS Service", "User", config_parse_string, 0, &user }, diff --git a/src/journal/coredump.c b/src/journal/coredump.c index 1b8c2e8bc0..cd612b7ebc 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -120,7 +120,7 @@ static int parse_config(void) { NULL, "Coredump\0", config_item_table_lookup, - (void*) items, + items, false, false, NULL); diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index f8da4daa41..097af24c5b 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1347,7 +1347,7 @@ static int server_parse_config_file(Server *s) { } r = config_parse(NULL, fn, f, "Journal\0", config_item_perf_lookup, - (void*) journald_gperf_lookup, false, false, s); + journald_gperf_lookup, false, false, s); if (r < 0) log_warning("Failed to parse configuration file: %s", strerror(-r)); diff --git a/src/login/logind.c b/src/login/logind.c index 7a7bd97150..a1881840e1 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -1113,7 +1113,7 @@ static int manager_parse_config_file(Manager *m) { } r = config_parse(NULL, fn, f, "Login\0", config_item_perf_lookup, - (void*) logind_gperf_lookup, false, false, m); + logind_gperf_lookup, false, false, m); if (r < 0) log_warning("Failed to parse configuration file: %s", strerror(-r)); diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index a97831760e..7d12af3938 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -525,7 +525,7 @@ static int netdev_load_one(Manager *manager, const char *filename) { r = config_parse(NULL, filename, file, "Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0Tun\0Tap\0Bond\0", - config_item_perf_lookup, (void*) network_netdev_gperf_lookup, + config_item_perf_lookup, network_netdev_gperf_lookup, false, false, netdev); if (r < 0) { log_warning("Could not parse config file %s: %s", filename, strerror(-r)); diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 0375194e46..252c9a0ab0 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -93,8 +93,10 @@ static int network_load_one(Manager *manager, const char *filename) { network->dhcp_routes = true; network->dhcp_sendhost = true; - r = config_parse(NULL, filename, file, "Match\0Network\0Address\0Route\0DHCP\0DHCPv4\0", config_item_perf_lookup, - (void*) network_network_gperf_lookup, false, false, network); + r = config_parse(NULL, filename, file, + "Match\0Network\0Address\0Route\0DHCP\0DHCPv4\0", + config_item_perf_lookup, network_network_gperf_lookup, + false, false, network); if (r < 0) { log_warning("Could not parse config file %s: %s", filename, strerror(-r)); return r; diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index dc6deeb7e5..8718ea40b2 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -377,10 +377,9 @@ int manager_parse_config_file(Manager *m) { assert(m); - r = config_parse(NULL, - "/etc/systemd/resolved.conf", NULL, + r = config_parse(NULL, "/etc/systemd/resolved.conf", NULL, "Resolve\0", - config_item_perf_lookup, (void*) resolved_gperf_lookup, + config_item_perf_lookup, resolved_gperf_lookup, false, false, m); if (r < 0) log_warning("Failed to parse configuration file: %s", strerror(-r)); diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 158e9efd4c..1f40986649 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -76,7 +76,7 @@ int log_syntax_internal(const char *unit, int level, } int config_item_table_lookup( - void *table, + const void *table, const char *section, const char *lvalue, ConfigParserCallback *func, @@ -84,7 +84,7 @@ int config_item_table_lookup( void **data, void *userdata) { - ConfigTableItem *t; + const ConfigTableItem *t; assert(table); assert(lvalue); @@ -110,7 +110,7 @@ int config_item_table_lookup( } int config_item_perf_lookup( - void *table, + const void *table, const char *section, const char *lvalue, ConfigParserCallback *func, @@ -154,7 +154,7 @@ static int next_assignment(const char *unit, const char *filename, unsigned line, ConfigItemLookup lookup, - void *table, + const void *table, const char *section, unsigned section_line, const char *lvalue, @@ -199,7 +199,7 @@ static int parse_line(const char* unit, unsigned line, const char *sections, ConfigItemLookup lookup, - void *table, + const void *table, bool relaxed, bool allow_include, char **section, @@ -323,7 +323,7 @@ int config_parse(const char *unit, FILE *f, const char *sections, ConfigItemLookup lookup, - void *table, + const void *table, bool relaxed, bool allow_include, void *userdata) { diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index 9d166de9c7..3e2c784805 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -65,7 +65,7 @@ typedef const ConfigPerfItem* (*ConfigPerfItemLookup)(const char *section_and_lv /* Prototype for a generic high-level lookup function */ typedef int (*ConfigItemLookup)( - void *table, + const void *table, const char *section, const char *lvalue, ConfigParserCallback *func, @@ -75,18 +75,18 @@ typedef int (*ConfigItemLookup)( /* Linear table search implementation of ConfigItemLookup, based on * ConfigTableItem arrays */ -int config_item_table_lookup(void *table, const char *section, const char *lvalue, ConfigParserCallback *func, int *ltype, void **data, void *userdata); +int config_item_table_lookup(const void *table, const char *section, const char *lvalue, ConfigParserCallback *func, int *ltype, void **data, void *userdata); /* gperf implementation of ConfigItemLookup, based on gperf * ConfigPerfItem tables */ -int config_item_perf_lookup(void *table, const char *section, const char *lvalue, ConfigParserCallback *func, int *ltype, void **data, void *userdata); +int config_item_perf_lookup(const void *table, const char *section, const char *lvalue, ConfigParserCallback *func, int *ltype, void **data, void *userdata); int config_parse(const char *unit, const char *filename, FILE *f, const char *sections, /* nulstr */ ConfigItemLookup lookup, - void *table, + const void *table, bool relaxed, bool allow_include, void *userdata); diff --git a/src/shared/install.c b/src/shared/install.c index 190c554347..a080d8f328 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1076,7 +1076,7 @@ static int unit_file_load( return -ENOMEM; } - r = config_parse(NULL, path, f, NULL, config_item_table_lookup, (void*) items, true, true, info); + r = config_parse(NULL, path, f, NULL, config_item_table_lookup, items, true, true, info); if (r < 0) return r; diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 867e4edaa2..4b2b0fe100 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -57,7 +57,7 @@ int parse_sleep_config(const char *verb, char ***_modes, char ***_states) { "Failed to open configuration file " PKGSYSCONFDIR "/sleep.conf: %m"); else { r = config_parse(NULL, PKGSYSCONFDIR "/sleep.conf", f, "Sleep\0", - config_item_table_lookup, (void*) items, false, false, NULL); + config_item_table_lookup, items, false, false, NULL); if (r < 0) log_warning("Failed to parse configuration file: %s", strerror(-r)); } diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c index 78ef5f72a1..67a434adee 100644 --- a/src/timesync/timesyncd.c +++ b/src/timesync/timesyncd.c @@ -1111,7 +1111,7 @@ static int manager_parse_config_file(Manager *m) { } r = config_parse(NULL, fn, f, "Time\0", config_item_perf_lookup, - (void*) timesyncd_gperf_lookup, false, false, m); + timesyncd_gperf_lookup, false, false, m); if (r < 0) log_warning("Failed to parse configuration file: %s", strerror(-r)); diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index 55a2215d0a..0398a9d814 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -272,7 +272,7 @@ static int parse_password(const char *filename, char **wall) { return -errno; } - r = config_parse(NULL, filename, f, NULL, config_item_table_lookup, (void*) items, true, false, NULL); + r = config_parse(NULL, filename, f, NULL, config_item_table_lookup, items, true, false, NULL); if (r < 0) { log_error("Failed to parse password file %s: %s", filename, strerror(-r)); goto finish; diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 5a45c53cc6..fe916a4326 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -174,8 +174,10 @@ static int load_link(link_config_ctx *ctx, const char *filename) { link->wol = _WOL_INVALID; link->duplex = _DUP_INVALID; - r = config_parse(NULL, filename, file, "Match\0Link\0Ethernet\0", config_item_perf_lookup, - (void*) link_config_gperf_lookup, false, false, link); + r = config_parse(NULL, filename, file, + "Match\0Link\0Ethernet\0", + config_item_perf_lookup, link_config_gperf_lookup, + false, false, link); if (r < 0) { log_warning("Could not parse config file %s: %s", filename, strerror(-r)); return r; |