Merge pull request #9701 from yuwata/string-table-cleanups

String table cleanups
This commit is contained in:
Lennart Poettering
2018-07-23 21:16:34 +02:00
committed by GitHub
6 changed files with 17 additions and 2 deletions
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "sd-device.h"
#include "hashmap.h"
#include "set.h"
+1
View File
@@ -22,6 +22,7 @@ int main(int argc, char **argv) {
test_table(bond_primary_reselect, NETDEV_BOND_PRIMARY_RESELECT);
test_table(bond_xmit_hash_policy, NETDEV_BOND_XMIT_HASH_POLICY);
test_table(dhcp6_message_status, DHCP6_STATUS);
/* test_table(dhcp6_message_type, DHCP6_MESSAGE); — enum starts from 1 */
test_table(dhcp_use_domains, DHCP_USE_DOMAINS);
test_table(duplex, DUP);
test_table(ip6tnl_mode, NETDEV_IP6_TNL_MODE);
+2 -1
View File
@@ -13,8 +13,9 @@ typedef enum DnsServerType {
DNS_SERVER_SYSTEM,
DNS_SERVER_FALLBACK,
DNS_SERVER_LINK,
_DNS_SERVER_TYPE_MAX,
_DNS_SERVER_TYPE_INVALID = -1
} DnsServerType;
#define _DNS_SERVER_TYPE_MAX (DNS_SERVER_LINK + 1)
const char* dns_server_type_to_string(DnsServerType i) _const_;
DnsServerType dns_server_type_from_string(const char *s) _pure_;
+7
View File
@@ -1,11 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "dns-type.h"
#include "resolved-dns-dnssec.h"
#include "resolved-dns-packet.h"
#include "test-tables.h"
int main(int argc, char **argv) {
uint16_t i;
test_table(dns_protocol, DNS_PROTOCOL);
test_table(dnssec_result, DNSSEC_RESULT);
test_table(dnssec_verdict, DNSSEC_VERDICT);
test_table_sparse(dns_rcode, DNS_RCODE);
test_table_sparse(dns_type, DNS_TYPE);
log_info("/* DNS_TYPE */");
+1 -1
View File
@@ -4927,7 +4927,7 @@ typedef enum SystemctlShowMode{
_SYSTEMCTL_SHOW_MODE_INVALID = -1,
} SystemctlShowMode;
static const char* const systemctl_show_mode_table[] = {
static const char* const systemctl_show_mode_table[_SYSTEMCTL_SHOW_MODE_MAX] = {
[SYSTEMCTL_SHOW_PROPERTIES] = "show",
[SYSTEMCTL_SHOW_STATUS] = "status",
[SYSTEMCTL_SHOW_HELP] = "help",
+4
View File
@@ -5,6 +5,7 @@
#include "cgroup.h"
#include "compress.h"
#include "condition.h"
#include "device-internal.h"
#include "device.h"
#include "execute.h"
#include "import-util.h"
@@ -47,7 +48,9 @@ int main(int argc, char **argv) {
test_table(collect_mode, COLLECT_MODE);
test_table(condition_result, CONDITION_RESULT);
test_table(condition_type, CONDITION_TYPE);
test_table(device_action, DEVICE_ACTION);
test_table(device_state, DEVICE_STATE);
test_table(dns_over_tls_mode, DNS_OVER_TLS_MODE);
test_table(dnssec_mode, DNSSEC_MODE);
test_table(emergency_action, EMERGENCY_ACTION);
test_table(exec_directory_type, EXEC_DIRECTORY_TYPE);
@@ -75,6 +78,7 @@ int main(int argc, char **argv) {
test_table(name_policy, NAMEPOLICY);
test_table(namespace_type, NAMESPACE_TYPE);
test_table(notify_access, NOTIFY_ACCESS);
test_table(notify_state, NOTIFY_STATE);
test_table(output_mode, OUTPUT_MODE);
test_table(partition_designator, PARTITION_DESIGNATOR);
test_table(path_result, PATH_RESULT);