/src/systemd/src/basic/string-table.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* SPDX-License-Identifier: LGPL-2.1+ */ |
2 | | |
3 | | #pragma once |
4 | | |
5 | | #include <errno.h> |
6 | | #include <stddef.h> |
7 | | #include <stdio.h> |
8 | | #include <string.h> |
9 | | #include <sys/types.h> |
10 | | |
11 | | #include "macro.h" |
12 | | #include "parse-util.h" |
13 | | #include "string-util.h" |
14 | | |
15 | | ssize_t string_table_lookup(const char * const *table, size_t len, const char *key); |
16 | | |
17 | | /* For basic lookup tables with strictly enumerated entries */ |
18 | | #define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ |
19 | 17.2M | scope const char *name##_to_string(type i) { \ |
20 | 17.2M | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ |
21 | 17.2M | return NULL; \ |
22 | 17.2M | return name##_table[i]; \ |
23 | 17.2M | } Line | Count | Source | 19 | 1.74k | scope const char *name##_to_string(type i) { \ | 20 | 1.74k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 1.74k | return NULL; \ | 22 | 1.74k | return name##_table[i]; \ | 23 | 1.74k | } |
Unexecuted instantiation: ip6tnl_mode_to_string Unexecuted instantiation: df_to_string Unexecuted instantiation: geneve_df_to_string Unexecuted instantiation: fou_encap_type_to_string Unexecuted instantiation: link_state_to_string Unexecuted instantiation: lldp_mode_to_string Unexecuted instantiation: radv_prefix_delegation_to_string Unexecuted instantiation: ipv6_privacy_extensions_to_string Unexecuted instantiation: dhcp_use_domains_to_string Unexecuted instantiation: keep_configuration_to_string Unexecuted instantiation: address_family_boolean_to_string Unexecuted instantiation: link_local_address_family_boolean_to_string Unexecuted instantiation: bond_mode_to_string Unexecuted instantiation: bond_xmit_hash_policy_to_string Unexecuted instantiation: bond_lacp_rate_to_string Unexecuted instantiation: bond_ad_select_to_string Unexecuted instantiation: bond_fail_over_mac_to_string Unexecuted instantiation: bond_arp_validate_to_string Unexecuted instantiation: bond_arp_all_targets_to_string Unexecuted instantiation: bond_primary_reselect_to_string Unexecuted instantiation: multicast_router_to_string Unexecuted instantiation: ipvlan_mode_to_string Unexecuted instantiation: ipvlan_flags_to_string Unexecuted instantiation: macvlan_mode_to_string Unexecuted instantiation: fdb_ntf_flags_to_string Line | Count | Source | 19 | 172 | scope const char *name##_to_string(type i) { \ | 20 | 172 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 172 | return NULL; \ | 22 | 172 | return name##_table[i]; \ | 23 | 172 | } |
dhcp6_message_type_to_string Line | Count | Source | 19 | 3.75k | scope const char *name##_to_string(type i) { \ | 20 | 3.75k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 3.75k | return NULL; \ | 22 | 3.75k | return name##_table[i]; \ | 23 | 3.75k | } |
dhcp6_message_status_to_string Line | Count | Source | 19 | 82 | scope const char *name##_to_string(type i) { \ | 20 | 82 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 82 | return NULL; \ | 22 | 82 | return name##_table[i]; \ | 23 | 82 | } |
Line | Count | Source | 19 | 98 | scope const char *name##_to_string(type i) { \ | 20 | 98 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 98 | return NULL; \ | 22 | 98 | return name##_table[i]; \ | 23 | 98 | } |
Unexecuted instantiation: storage_to_string Unexecuted instantiation: split_mode_to_string Unexecuted instantiation: manager_state_to_string Unexecuted instantiation: manager_timestamp_to_string Unexecuted instantiation: oom_policy_to_string Line | Count | Source | 19 | 8 | scope const char *name##_to_string(type i) { \ | 20 | 8 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 8 | return NULL; \ | 22 | 8 | return name##_table[i]; \ | 23 | 8 | } |
Line | Count | Source | 19 | 8 | scope const char *name##_to_string(type i) { \ | 20 | 8 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 8 | return NULL; \ | 22 | 8 | return name##_table[i]; \ | 23 | 8 | } |
Unexecuted instantiation: namespace_type_to_string Unexecuted instantiation: namespace.c:mount_mode_to_string Unexecuted instantiation: path_type_to_string Unexecuted instantiation: path_result_to_string Unexecuted instantiation: service_restart_to_string Unexecuted instantiation: service_type_to_string Unexecuted instantiation: service_exec_command_to_string Unexecuted instantiation: service_exec_ex_command_to_string Unexecuted instantiation: notify_state_to_string Unexecuted instantiation: service_result_to_string Unexecuted instantiation: show_status_to_string Unexecuted instantiation: socket_exec_command_to_string Unexecuted instantiation: socket_result_to_string Unexecuted instantiation: timer_base_to_string Unexecuted instantiation: timer_result_to_string Line | Count | Source | 19 | 53.3k | scope const char *name##_to_string(type i) { \ | 20 | 53.3k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 53.3k | return NULL; \ | 22 | 53.3k | return name##_table[i]; \ | 23 | 53.3k | } |
Unexecuted instantiation: automount_result_to_string cgroup_device_policy_to_string Line | Count | Source | 19 | 5.30k | scope const char *name##_to_string(type i) { \ | 20 | 5.30k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 5.30k | return NULL; \ | 22 | 5.30k | return name##_table[i]; \ | 23 | 5.30k | } |
emergency_action_to_string Line | Count | Source | 19 | 42 | scope const char *name##_to_string(type i) { \ | 20 | 42 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 42 | return NULL; \ | 22 | 42 | return name##_table[i]; \ | 23 | 42 | } |
Line | Count | Source | 19 | 8 | scope const char *name##_to_string(type i) { \ | 20 | 8 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 8 | return NULL; \ | 22 | 8 | return name##_table[i]; \ | 23 | 8 | } |
Line | Count | Source | 19 | 16 | scope const char *name##_to_string(type i) { \ | 20 | 16 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 16 | return NULL; \ | 22 | 16 | return name##_table[i]; \ | 23 | 16 | } |
Unexecuted instantiation: exec_utmp_mode_to_string exec_preserve_mode_to_string Line | Count | Source | 19 | 8 | scope const char *name##_to_string(type i) { \ | 20 | 8 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 8 | return NULL; \ | 22 | 8 | return name##_table[i]; \ | 23 | 8 | } |
exec_directory_type_to_string Line | Count | Source | 19 | 40 | scope const char *name##_to_string(type i) { \ | 20 | 40 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 40 | return NULL; \ | 22 | 40 | return name##_table[i]; \ | 23 | 40 | } |
exec_keyring_mode_to_string Line | Count | Source | 19 | 8 | scope const char *name##_to_string(type i) { \ | 20 | 8 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 8 | return NULL; \ | 22 | 8 | return name##_table[i]; \ | 23 | 8 | } |
Unexecuted instantiation: execute.c:exec_directory_env_name_to_string Unexecuted instantiation: job_state_to_string Unexecuted instantiation: job_type_to_string Line | Count | Source | 19 | 6.94k | scope const char *name##_to_string(type i) { \ | 20 | 6.94k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 6.94k | return NULL; \ | 22 | 6.94k | return name##_table[i]; \ | 23 | 6.94k | } |
Unexecuted instantiation: job_result_to_string Line | Count | Source | 19 | 8 | scope const char *name##_to_string(type i) { \ | 20 | 8 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 8 | return NULL; \ | 22 | 8 | return name##_table[i]; \ | 23 | 8 | } |
Unexecuted instantiation: kill_who_to_string Unexecuted instantiation: mount_exec_command_to_string Line | Count | Source | 19 | 8 | scope const char *name##_to_string(type i) { \ | 20 | 8 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 8 | return NULL; \ | 22 | 8 | return name##_table[i]; \ | 23 | 8 | } |
Unexecuted instantiation: scope_result_to_string Unexecuted instantiation: swap_exec_command_to_string Unexecuted instantiation: swap_result_to_string Unexecuted instantiation: dns_rcode_to_string Unexecuted instantiation: dns_protocol_to_string Unexecuted instantiation: dnssec_result_to_string Unexecuted instantiation: dnssec_verdict_to_string Unexecuted instantiation: resolv_conf_mode_to_string Unexecuted instantiation: timezone_mode_to_string Unexecuted instantiation: mac_address_policy_to_string Unexecuted instantiation: name_policy_to_string Unexecuted instantiation: duplex_to_string Unexecuted instantiation: wol_to_string Unexecuted instantiation: port_to_string Unexecuted instantiation: ethtool_link_mode_bit_to_string Line | Count | Source | 19 | 1.36k | scope const char *name##_to_string(type i) { \ | 20 | 1.36k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 1.36k | return NULL; \ | 22 | 1.36k | return name##_table[i]; \ | 23 | 1.36k | } |
Line | Count | Source | 19 | 1.77k | scope const char *name##_to_string(type i) { \ | 20 | 1.77k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 1.77k | return NULL; \ | 22 | 1.77k | return name##_table[i]; \ | 23 | 1.77k | } |
condition_result_to_string Line | Count | Source | 19 | 3.13k | scope const char *name##_to_string(type i) { \ | 20 | 3.13k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 3.13k | return NULL; \ | 22 | 3.13k | return name##_table[i]; \ | 23 | 3.13k | } |
Unexecuted instantiation: partition_designator_to_string Unexecuted instantiation: import_verify_to_string Unexecuted instantiation: unit_file_state_to_string Unexecuted instantiation: unit_file_change_type_to_string Unexecuted instantiation: unit_file_preset_mode_to_string Unexecuted instantiation: install.c:unit_file_type_to_string Unexecuted instantiation: json_variant_type_to_string Unexecuted instantiation: image_type_to_string Unexecuted instantiation: output_mode_to_string Unexecuted instantiation: resolve_support_to_string Unexecuted instantiation: dnssec_mode_to_string Unexecuted instantiation: dns_over_tls_mode_to_string Unexecuted instantiation: resolve_name_timing_to_string Unexecuted instantiation: varlink.c:varlink_state_to_string Unexecuted instantiation: volatile_mode_to_string Unexecuted instantiation: architecture_to_string Unexecuted instantiation: cgroup_io_limit_type_to_string cgroup_controller_to_string Line | Count | Source | 19 | 17.0M | scope const char *name##_to_string(type i) { \ | 20 | 17.0M | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 17.0M | return NULL; \ | 22 | 17.0M | return name##_table[i]; \ | 23 | 17.0M | } |
Unexecuted instantiation: locale_variable_to_string Unexecuted instantiation: log_target_to_string Unexecuted instantiation: sigchld_code_to_string Unexecuted instantiation: rlimit_to_string signal-util.c:__signal_to_string Line | Count | Source | 19 | 16 | scope const char *name##_to_string(type i) { \ | 20 | 16 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 16 | return NULL; \ | 22 | 16 | return name##_table[i]; \ | 23 | 16 | } |
Unexecuted instantiation: smack_attr_to_string Unexecuted instantiation: socket_address_type_to_string Unexecuted instantiation: socket_address_bind_ipv6_only_to_string Line | Count | Source | 19 | 18.0k | scope const char *name##_to_string(type i) { \ | 20 | 18.0k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 18.0k | return NULL; \ | 22 | 18.0k | return name##_table[i]; \ | 23 | 18.0k | } |
unit_load_state_to_string Line | Count | Source | 19 | 53.3k | scope const char *name##_to_string(type i) { \ | 20 | 53.3k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 53.3k | return NULL; \ | 22 | 53.3k | return name##_table[i]; \ | 23 | 53.3k | } |
unit_active_state_to_string Line | Count | Source | 19 | 53.3k | scope const char *name##_to_string(type i) { \ | 20 | 53.3k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 53.3k | return NULL; \ | 22 | 53.3k | return name##_table[i]; \ | 23 | 53.3k | } |
Unexecuted instantiation: automount_state_to_string Line | Count | Source | 19 | 1.64k | scope const char *name##_to_string(type i) { \ | 20 | 1.64k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 1.64k | return NULL; \ | 22 | 1.64k | return name##_table[i]; \ | 23 | 1.64k | } |
Line | Count | Source | 19 | 8 | scope const char *name##_to_string(type i) { \ | 20 | 8 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 8 | return NULL; \ | 22 | 8 | return name##_table[i]; \ | 23 | 8 | } |
Unexecuted instantiation: path_state_to_string Unexecuted instantiation: scope_state_to_string Unexecuted instantiation: service_state_to_string Line | Count | Source | 19 | 5.29k | scope const char *name##_to_string(type i) { \ | 20 | 5.29k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 5.29k | return NULL; \ | 22 | 5.29k | return name##_table[i]; \ | 23 | 5.29k | } |
Unexecuted instantiation: socket_state_to_string Unexecuted instantiation: swap_state_to_string Unexecuted instantiation: target_state_to_string Unexecuted instantiation: timer_state_to_string unit_dependency_to_string Line | Count | Source | 19 | 53.7k | scope const char *name##_to_string(type i) { \ | 20 | 53.7k | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 53.7k | return NULL; \ | 22 | 53.7k | return name##_table[i]; \ | 23 | 53.7k | } |
Unexecuted instantiation: notify_access_to_string Line | Count | Source | 19 | 617 | scope const char *name##_to_string(type i) { \ | 20 | 617 | if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ | 21 | 617 | return NULL; \ | 22 | 617 | return name##_table[i]; \ | 23 | 617 | } |
Unexecuted instantiation: device_action_to_string Unexecuted instantiation: nl_union_link_info_data_to_string Unexecuted instantiation: link_operstate_to_string Unexecuted instantiation: sd-event.c:event_source_type_to_string Unexecuted instantiation: object_compressed_to_string |
24 | | |
25 | | #define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \ |
26 | 2.33M | scope type name##_from_string(const char *s) { \ |
27 | 2.33M | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ |
28 | 2.33M | } Line | Count | Source | 26 | 13.3k | scope type name##_from_string(const char *s) { \ | 27 | 13.3k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 13.3k | } |
Line | Count | Source | 26 | 415 | scope type name##_from_string(const char *s) { \ | 27 | 415 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 415 | } |
fou_encap_type_from_string Line | Count | Source | 26 | 481 | scope type name##_from_string(const char *s) { \ | 27 | 481 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 481 | } |
Unexecuted instantiation: l2tp-tunnel.c:l2tp_encap_type_from_string Unexecuted instantiation: l2tp-tunnel.c:l2tp_local_address_type_from_string Unexecuted instantiation: l2tp-tunnel.c:l2tp_l2spec_type_from_string Unexecuted instantiation: link_state_from_string ipv6_privacy_extensions_from_string Line | Count | Source | 26 | 773 | scope type name##_from_string(const char *s) { \ | 27 | 773 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 773 | } |
networkd-network.c:dhcp_client_identifier_from_string Line | Count | Source | 26 | 415 | scope type name##_from_string(const char *s) { \ | 27 | 415 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 415 | } |
Line | Count | Source | 26 | 545 | scope type name##_from_string(const char *s) { \ | 27 | 545 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 545 | } |
bond_xmit_hash_policy_from_string Line | Count | Source | 26 | 409 | scope type name##_from_string(const char *s) { \ | 27 | 409 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 409 | } |
bond_lacp_rate_from_string Line | Count | Source | 26 | 396 | scope type name##_from_string(const char *s) { \ | 27 | 396 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 396 | } |
Unexecuted instantiation: bond_ad_select_from_string Unexecuted instantiation: bond_fail_over_mac_from_string Unexecuted instantiation: bond_arp_validate_from_string Unexecuted instantiation: bond_arp_all_targets_from_string Unexecuted instantiation: bond_primary_reselect_from_string Line | Count | Source | 26 | 408 | scope type name##_from_string(const char *s) { \ | 27 | 408 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 408 | } |
Unexecuted instantiation: ipvlan_flags_from_string Line | Count | Source | 26 | 575 | scope type name##_from_string(const char *s) { \ | 27 | 575 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 575 | } |
networkd-conf.c:duid_type_from_string Line | Count | Source | 26 | 11.2k | scope type name##_from_string(const char *s) { \ | 27 | 11.2k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 11.2k | } |
Unexecuted instantiation: fdb_ntf_flags_from_string Unexecuted instantiation: ndisc_event_from_string Unexecuted instantiation: dhcp6_message_type_from_string Unexecuted instantiation: dhcp6_message_status_from_string Unexecuted instantiation: lldp_event_from_string Unexecuted instantiation: storage_from_string Unexecuted instantiation: split_mode_from_string Unexecuted instantiation: manager_state_from_string Unexecuted instantiation: manager_timestamp_from_string Line | Count | Source | 26 | 195 | scope type name##_from_string(const char *s) { \ | 27 | 195 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 195 | } |
Unexecuted instantiation: namespace_type_from_string Line | Count | Source | 26 | 820 | scope type name##_from_string(const char *s) { \ | 27 | 820 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 820 | } |
Unexecuted instantiation: path_result_from_string service_restart_from_string Line | Count | Source | 26 | 390 | scope type name##_from_string(const char *s) { \ | 27 | 390 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 390 | } |
Line | Count | Source | 26 | 528 | scope type name##_from_string(const char *s) { \ | 27 | 528 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 528 | } |
Unexecuted instantiation: service_exec_command_from_string Unexecuted instantiation: service_exec_ex_command_from_string Unexecuted instantiation: notify_state_from_string Unexecuted instantiation: service_result_from_string Unexecuted instantiation: socket_exec_command_from_string Unexecuted instantiation: socket_result_from_string Unexecuted instantiation: timer_base_from_string Unexecuted instantiation: timer_result_from_string Line | Count | Source | 26 | 432 | scope type name##_from_string(const char *s) { \ | 27 | 432 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 432 | } |
Unexecuted instantiation: automount_result_from_string cgroup_device_policy_from_string Line | Count | Source | 26 | 391 | scope type name##_from_string(const char *s) { \ | 27 | 391 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 391 | } |
emergency_action_from_string Line | Count | Source | 26 | 595 | scope type name##_from_string(const char *s) { \ | 27 | 595 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 595 | } |
Line | Count | Source | 26 | 46.2k | scope type name##_from_string(const char *s) { \ | 27 | 46.2k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 46.2k | } |
Line | Count | Source | 26 | 683 | scope type name##_from_string(const char *s) { \ | 27 | 683 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 683 | } |
exec_utmp_mode_from_string Line | Count | Source | 26 | 395 | scope type name##_from_string(const char *s) { \ | 27 | 395 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 395 | } |
Unexecuted instantiation: exec_directory_type_from_string exec_keyring_mode_from_string Line | Count | Source | 26 | 397 | scope type name##_from_string(const char *s) { \ | 27 | 397 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 397 | } |
Unexecuted instantiation: job_state_from_string Unexecuted instantiation: job_type_from_string Line | Count | Source | 26 | 613 | scope type name##_from_string(const char *s) { \ | 27 | 613 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 613 | } |
Unexecuted instantiation: job_result_from_string Line | Count | Source | 26 | 389 | scope type name##_from_string(const char *s) { \ | 27 | 389 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 389 | } |
Unexecuted instantiation: kill_who_from_string Unexecuted instantiation: mount_exec_command_from_string Unexecuted instantiation: mount_result_from_string Unexecuted instantiation: scope_result_from_string Unexecuted instantiation: swap_exec_command_from_string Unexecuted instantiation: swap_result_from_string Unexecuted instantiation: dns_rcode_from_string Unexecuted instantiation: dns_protocol_from_string Unexecuted instantiation: dnssec_result_from_string Unexecuted instantiation: dnssec_verdict_from_string mac_address_policy_from_string Line | Count | Source | 26 | 388 | scope type name##_from_string(const char *s) { \ | 27 | 388 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 388 | } |
Line | Count | Source | 26 | 1.89k | scope type name##_from_string(const char *s) { \ | 27 | 1.89k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 1.89k | } |
Line | Count | Source | 26 | 389 | scope type name##_from_string(const char *s) { \ | 27 | 389 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 389 | } |
Line | Count | Source | 26 | 389 | scope type name##_from_string(const char *s) { \ | 27 | 389 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 389 | } |
Line | Count | Source | 26 | 448 | scope type name##_from_string(const char *s) { \ | 27 | 448 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 448 | } |
ethtool_link_mode_bit_from_string Line | Count | Source | 26 | 742 | scope type name##_from_string(const char *s) { \ | 27 | 742 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 742 | } |
Unexecuted instantiation: condition_type_from_string Unexecuted instantiation: assert_type_from_string Unexecuted instantiation: condition_result_from_string Unexecuted instantiation: partition_designator_from_string Unexecuted instantiation: import_verify_from_string Unexecuted instantiation: unit_file_state_from_string Unexecuted instantiation: unit_file_change_type_from_string Unexecuted instantiation: unit_file_preset_mode_from_string Unexecuted instantiation: json_variant_type_from_string Unexecuted instantiation: image_type_from_string Unexecuted instantiation: output_mode_from_string Unexecuted instantiation: resolve_name_timing_from_string Line | Count | Source | 26 | 1.51k | scope type name##_from_string(const char *s) { \ | 27 | 1.51k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 1.51k | } |
cgroup_io_limit_type_from_string Line | Count | Source | 26 | 2.73k | scope type name##_from_string(const char *s) { \ | 27 | 2.73k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 2.73k | } |
cgroup_controller_from_string Line | Count | Source | 26 | 4.72k | scope type name##_from_string(const char *s) { \ | 27 | 4.72k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 4.72k | } |
Unexecuted instantiation: locale_variable_from_string Unexecuted instantiation: log_target_from_string Unexecuted instantiation: sigchld_code_from_string Line | Count | Source | 26 | 96 | scope type name##_from_string(const char *s) { \ | 27 | 96 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 96 | } |
signal-util.c:__signal_from_string Line | Count | Source | 26 | 12.0k | scope type name##_from_string(const char *s) { \ | 27 | 12.0k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 12.0k | } |
Unexecuted instantiation: smack_attr_from_string Unexecuted instantiation: socket_address_type_from_string socket_address_bind_ipv6_only_from_string Line | Count | Source | 26 | 197 | scope type name##_from_string(const char *s) { \ | 27 | 197 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 197 | } |
Line | Count | Source | 26 | 2.22M | scope type name##_from_string(const char *s) { \ | 27 | 2.22M | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 2.22M | } |
Unexecuted instantiation: unit_load_state_from_string Unexecuted instantiation: unit_active_state_from_string Unexecuted instantiation: automount_state_from_string Unexecuted instantiation: device_state_from_string Unexecuted instantiation: mount_state_from_string Unexecuted instantiation: path_state_from_string Unexecuted instantiation: scope_state_from_string Unexecuted instantiation: service_state_from_string Unexecuted instantiation: slice_state_from_string Unexecuted instantiation: socket_state_from_string Unexecuted instantiation: swap_state_from_string Unexecuted instantiation: target_state_from_string Unexecuted instantiation: timer_state_from_string Unexecuted instantiation: unit_dependency_from_string notify_access_from_string Line | Count | Source | 26 | 389 | scope type name##_from_string(const char *s) { \ | 27 | 389 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 389 | } |
Unexecuted instantiation: virtualization_from_string Unexecuted instantiation: device_action_from_string nl_union_link_info_data_from_string Line | Count | Source | 26 | 533 | scope type name##_from_string(const char *s) { \ | 27 | 533 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 533 | } |
link_operstate_from_string Line | Count | Source | 26 | 766 | scope type name##_from_string(const char *s) { \ | 27 | 766 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 28 | 766 | } |
Unexecuted instantiation: object_compressed_from_string |
29 | | |
30 | | #define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,scope) \ |
31 | 14.5k | scope type name##_from_string(const char *s) { \ |
32 | 14.5k | int b; \ |
33 | 14.5k | if (!s) \ |
34 | 14.5k | return -1; \ |
35 | 14.5k | b = parse_boolean(s); \ |
36 | 14.5k | if (b == 0) \ |
37 | 14.5k | return (type) 0; \ |
38 | 14.5k | else if (b > 0) \ |
39 | 9.98k | return yes; \ |
40 | 14.5k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ |
41 | 14.5k | } Unexecuted instantiation: df_from_string Unexecuted instantiation: geneve_df_from_string Line | Count | Source | 31 | 995 | scope type name##_from_string(const char *s) { \ | 32 | 995 | int b; \ | 33 | 995 | if (!s) \ | 34 | 995 | return -1; \ | 35 | 995 | b = parse_boolean(s); \ | 36 | 995 | if (b == 0) \ | 37 | 995 | return (type) 0; \ | 38 | 995 | else if (b > 0) \ | 39 | 615 | return yes; \ | 40 | 995 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 995 | } |
radv_prefix_delegation_from_string Line | Count | Source | 31 | 583 | scope type name##_from_string(const char *s) { \ | 32 | 583 | int b; \ | 33 | 583 | if (!s) \ | 34 | 583 | return -1; \ | 35 | 583 | b = parse_boolean(s); \ | 36 | 583 | if (b == 0) \ | 37 | 583 | return (type) 0; \ | 38 | 583 | else if (b > 0) \ | 39 | 389 | return yes; \ | 40 | 583 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 583 | } |
dhcp_use_domains_from_string Line | Count | Source | 31 | 663 | scope type name##_from_string(const char *s) { \ | 32 | 663 | int b; \ | 33 | 663 | if (!s) \ | 34 | 663 | return -1; \ | 35 | 663 | b = parse_boolean(s); \ | 36 | 663 | if (b == 0) \ | 37 | 663 | return (type) 0; \ | 38 | 663 | else if (b > 0) \ | 39 | 462 | return yes; \ | 40 | 663 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 663 | } |
Unexecuted instantiation: keep_configuration_from_string address_family_boolean_from_string Line | Count | Source | 31 | 3.66k | scope type name##_from_string(const char *s) { \ | 32 | 3.66k | int b; \ | 33 | 3.66k | if (!s) \ | 34 | 3.66k | return -1; \ | 35 | 3.66k | b = parse_boolean(s); \ | 36 | 3.66k | if (b == 0) \ | 37 | 3.66k | return (type) 0; \ | 38 | 3.66k | else if (b > 0) \ | 39 | 3.43k | return yes; \ | 40 | 3.66k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 3.66k | } |
link_local_address_family_boolean_from_string Line | Count | Source | 31 | 1.34k | scope type name##_from_string(const char *s) { \ | 32 | 1.34k | int b; \ | 33 | 1.34k | if (!s) \ | 34 | 1.34k | return -1; \ | 35 | 1.34k | b = parse_boolean(s); \ | 36 | 1.34k | if (b == 0) \ | 37 | 1.34k | return (type) 0; \ | 38 | 1.34k | else if (b > 0) \ | 39 | 400 | return yes; \ | 40 | 1.34k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 1.34k | } |
multicast_router_from_string Line | Count | Source | 31 | 734 | scope type name##_from_string(const char *s) { \ | 32 | 734 | int b; \ | 33 | 734 | if (!s) \ | 34 | 734 | return -1; \ | 35 | 734 | b = parse_boolean(s); \ | 36 | 734 | if (b == 0) \ | 37 | 734 | return (type) 0; \ | 38 | 734 | else if (b > 0) \ | 39 | 417 | return yes; \ | 40 | 734 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 734 | } |
Line | Count | Source | 31 | 620 | scope type name##_from_string(const char *s) { \ | 32 | 620 | int b; \ | 33 | 620 | if (!s) \ | 34 | 620 | return -1; \ | 35 | 620 | b = parse_boolean(s); \ | 36 | 620 | if (b == 0) \ | 37 | 620 | return (type) 0; \ | 38 | 620 | else if (b > 0) \ | 39 | 404 | return yes; \ | 40 | 620 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 620 | } |
protect_system_from_string Line | Count | Source | 31 | 979 | scope type name##_from_string(const char *s) { \ | 32 | 979 | int b; \ | 33 | 979 | if (!s) \ | 34 | 979 | return -1; \ | 35 | 979 | b = parse_boolean(s); \ | 36 | 979 | if (b == 0) \ | 37 | 979 | return (type) 0; \ | 38 | 979 | else if (b > 0) \ | 39 | 785 | return yes; \ | 40 | 979 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 979 | } |
Unexecuted instantiation: show_status_from_string exec_preserve_mode_from_string Line | Count | Source | 31 | 585 | scope type name##_from_string(const char *s) { \ | 32 | 585 | int b; \ | 33 | 585 | if (!s) \ | 34 | 585 | return -1; \ | 35 | 585 | b = parse_boolean(s); \ | 36 | 585 | if (b == 0) \ | 37 | 585 | return (type) 0; \ | 38 | 585 | else if (b > 0) \ | 39 | 391 | return yes; \ | 40 | 585 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 585 | } |
Unexecuted instantiation: resolv_conf_mode_from_string timezone_mode_from_string Line | Count | Source | 31 | 608 | scope type name##_from_string(const char *s) { \ | 32 | 608 | int b; \ | 33 | 608 | if (!s) \ | 34 | 608 | return -1; \ | 35 | 608 | b = parse_boolean(s); \ | 36 | 608 | if (b == 0) \ | 37 | 608 | return (type) 0; \ | 38 | 608 | else if (b > 0) \ | 39 | 409 | return yes; \ | 40 | 608 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 608 | } |
resolve_support_from_string Line | Count | Source | 31 | 646 | scope type name##_from_string(const char *s) { \ | 32 | 646 | int b; \ | 33 | 646 | if (!s) \ | 34 | 646 | return -1; \ | 35 | 646 | b = parse_boolean(s); \ | 36 | 646 | if (b == 0) \ | 37 | 646 | return (type) 0; \ | 38 | 646 | else if (b > 0) \ | 39 | 452 | return yes; \ | 40 | 646 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 646 | } |
Line | Count | Source | 31 | 604 | scope type name##_from_string(const char *s) { \ | 32 | 604 | int b; \ | 33 | 604 | if (!s) \ | 34 | 604 | return -1; \ | 35 | 604 | b = parse_boolean(s); \ | 36 | 604 | if (b == 0) \ | 37 | 604 | return (type) 0; \ | 38 | 604 | else if (b > 0) \ | 39 | 410 | return yes; \ | 40 | 604 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 604 | } |
dns_over_tls_mode_from_string Line | Count | Source | 31 | 618 | scope type name##_from_string(const char *s) { \ | 32 | 618 | int b; \ | 33 | 618 | if (!s) \ | 34 | 618 | return -1; \ | 35 | 618 | b = parse_boolean(s); \ | 36 | 618 | if (b == 0) \ | 37 | 618 | return (type) 0; \ | 38 | 618 | else if (b > 0) \ | 39 | 424 | return yes; \ | 40 | 618 | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 618 | } |
volatile_mode_from_string Line | Count | Source | 31 | 1.89k | scope type name##_from_string(const char *s) { \ | 32 | 1.89k | int b; \ | 33 | 1.89k | if (!s) \ | 34 | 1.89k | return -1; \ | 35 | 1.89k | b = parse_boolean(s); \ | 36 | 1.89k | if (b == 0) \ | 37 | 1.89k | return (type) 0; \ | 38 | 1.89k | else if (b > 0) \ | 39 | 992 | return yes; \ | 40 | 1.89k | return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 41 | 1.89k | } |
|
42 | | |
43 | | #define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max,scope) \ |
44 | 0 | scope int name##_to_string_alloc(type i, char **str) { \ |
45 | 0 | char *s; \ |
46 | 0 | if (i < 0 || i > max) \ |
47 | 0 | return -ERANGE; \ |
48 | 0 | if (i < (type) ELEMENTSOF(name##_table)) { \ |
49 | 0 | s = strdup(name##_table[i]); \ |
50 | 0 | if (!s) \ |
51 | 0 | return -ENOMEM; \ |
52 | 0 | } else { \ |
53 | 0 | if (asprintf(&s, "%i", i) < 0) \ |
54 | 0 | return -ENOMEM; \ |
55 | 0 | } \ |
56 | 0 | *str = s; \ |
57 | 0 | return 0; \ |
58 | 0 | } Unexecuted instantiation: dnssec_algorithm_to_string_alloc Unexecuted instantiation: dnssec_digest_to_string_alloc Unexecuted instantiation: ioprio_class_to_string_alloc Unexecuted instantiation: sched_policy_to_string_alloc Unexecuted instantiation: netlink_family_to_string_alloc Unexecuted instantiation: ip_tos_to_string_alloc Unexecuted instantiation: log_facility_unshifted_to_string_alloc Unexecuted instantiation: log_level_to_string_alloc |
59 | | |
60 | | #define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,scope) \ |
61 | 7.18k | scope type name##_from_string(const char *s) { \ |
62 | 7.18k | unsigned u = 0; \ |
63 | 7.18k | type i; \ |
64 | 7.18k | if (!s) \ |
65 | 7.18k | return (type) -1; \ |
66 | 7.18k | i = (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ |
67 | 7.18k | if (i >= 0) \ |
68 | 7.18k | return i; \ |
69 | 7.18k | if (safe_atou(s, &u) >= 0 && u <= max) \ |
70 | 5.99k | return (type) u; \ |
71 | 5.99k | return (type) -1; \ |
72 | 5.99k | } \ Unexecuted instantiation: dnssec_algorithm_from_string Unexecuted instantiation: dnssec_digest_from_string Line | Count | Source | 61 | 812 | scope type name##_from_string(const char *s) { \ | 62 | 812 | unsigned u = 0; \ | 63 | 812 | type i; \ | 64 | 812 | if (!s) \ | 65 | 812 | return (type) -1; \ | 66 | 812 | i = (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 67 | 812 | if (i >= 0) \ | 68 | 812 | return i; \ | 69 | 812 | if (safe_atou(s, &u) >= 0 && u <= max) \ | 70 | 618 | return (type) u; \ | 71 | 618 | return (type) -1; \ | 72 | 618 | } \ |
Line | Count | Source | 61 | 1.47k | scope type name##_from_string(const char *s) { \ | 62 | 1.47k | unsigned u = 0; \ | 63 | 1.47k | type i; \ | 64 | 1.47k | if (!s) \ | 65 | 1.47k | return (type) -1; \ | 66 | 1.47k | i = (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 67 | 1.47k | if (i >= 0) \ | 68 | 1.47k | return i; \ | 69 | 1.47k | if (safe_atou(s, &u) >= 0 && u <= max) \ | 70 | 1.27k | return (type) u; \ | 71 | 1.27k | return (type) -1; \ | 72 | 1.27k | } \ |
netlink_family_from_string Line | Count | Source | 61 | 1.79k | scope type name##_from_string(const char *s) { \ | 62 | 1.79k | unsigned u = 0; \ | 63 | 1.79k | type i; \ | 64 | 1.79k | if (!s) \ | 65 | 1.79k | return (type) -1; \ | 66 | 1.79k | i = (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 67 | 1.79k | if (i >= 0) \ | 68 | 1.79k | return i; \ | 69 | 1.79k | if (safe_atou(s, &u) >= 0 && u <= max) \ | 70 | 1.57k | return (type) u; \ | 71 | 1.57k | return (type) -1; \ | 72 | 1.57k | } \ |
Line | Count | Source | 61 | 1.40k | scope type name##_from_string(const char *s) { \ | 62 | 1.40k | unsigned u = 0; \ | 63 | 1.40k | type i; \ | 64 | 1.40k | if (!s) \ | 65 | 1.40k | return (type) -1; \ | 66 | 1.40k | i = (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 67 | 1.40k | if (i >= 0) \ | 68 | 1.40k | return i; \ | 69 | 1.40k | if (safe_atou(s, &u) >= 0 && u <= max) \ | 70 | 1.21k | return (type) u; \ | 71 | 1.21k | return (type) -1; \ | 72 | 1.21k | } \ |
log_facility_unshifted_from_string Line | Count | Source | 61 | 855 | scope type name##_from_string(const char *s) { \ | 62 | 855 | unsigned u = 0; \ | 63 | 855 | type i; \ | 64 | 855 | if (!s) \ | 65 | 855 | return (type) -1; \ | 66 | 855 | i = (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 67 | 855 | if (i >= 0) \ | 68 | 855 | return i; \ | 69 | 855 | if (safe_atou(s, &u) >= 0 && u <= max) \ | 70 | 661 | return (type) u; \ | 71 | 661 | return (type) -1; \ | 72 | 661 | } \ |
Line | Count | Source | 61 | 842 | scope type name##_from_string(const char *s) { \ | 62 | 842 | unsigned u = 0; \ | 63 | 842 | type i; \ | 64 | 842 | if (!s) \ | 65 | 842 | return (type) -1; \ | 66 | 842 | i = (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \ | 67 | 842 | if (i >= 0) \ | 68 | 842 | return i; \ | 69 | 842 | if (safe_atou(s, &u) >= 0 && u <= max) \ | 70 | 648 | return (type) u; \ | 71 | 648 | return (type) -1; \ | 72 | 648 | } \ |
|
73 | | |
74 | | #define _DEFINE_STRING_TABLE_LOOKUP(name,type,scope) \ |
75 | | _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ |
76 | | _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) |
77 | | |
78 | | #define _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes,scope) \ |
79 | | _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ |
80 | | _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,scope) |
81 | | |
82 | | #define DEFINE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,) |
83 | | #define DEFINE_PRIVATE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,static) |
84 | | #define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(name,type) _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,static) |
85 | | #define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(name,type) _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,static) |
86 | | |
87 | | #define DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes) _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes,) |
88 | | |
89 | | /* For string conversions where numbers are also acceptable */ |
90 | | #define DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(name,type,max) \ |
91 | | _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max,) \ |
92 | | _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,) |
93 | | |
94 | | #define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max) \ |
95 | | _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max,static) |
96 | | #define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max) \ |
97 | | _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,static) |
98 | | |
99 | | #define DUMP_STRING_TABLE(name,type,max) \ |
100 | | do { \ |
101 | | type _k; \ |
102 | | flockfile(stdout); \ |
103 | | for (_k = 0; _k < (max); _k++) { \ |
104 | | const char *_t; \ |
105 | | _t = name##_to_string(_k); \ |
106 | | if (!_t) \ |
107 | | continue; \ |
108 | | fputs_unlocked(_t, stdout); \ |
109 | | fputc_unlocked('\n', stdout); \ |
110 | | } \ |
111 | | funlockfile(stdout); \ |
112 | | } while(false) |