From: Kevin Day Date: Thu, 12 Sep 2019 02:03:08 +0000 (-0500) Subject: Update: start enum's at 1 where possible X-Git-Tag: 0.5.0~428 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=67522a6fe111a3e4d53308c7b3e975f8846d5bf0;p=fll Update: start enum's at 1 where possible By always setting enums as 1, the 0 value can be reserved as not-set. There are still a few situations where enums must not start at 1. Some are: 1) Type defenitions, so as in f_types where the status codes need to start at 0 for f_false. 2) Any enums that map 1to1 to an array, such as with parameter options. --- diff --git a/level_0/f_console/c/console.h b/level_0/f_console/c/console.h index b3605dc..43ff9ec 100644 --- a/level_0/f_console/c/console.h +++ b/level_0/f_console/c/console.h @@ -27,7 +27,7 @@ extern "C" { */ #ifndef _di_f_console_ids_ enum { - f_console_none, + f_console_none = 1, f_console_short_enable, f_console_short_disable, f_console_long_enable, @@ -107,13 +107,13 @@ extern "C" { typedef unsigned short f_console_id; enum { - f_console_result_none, + f_console_result_none = 1, f_console_result_found, f_console_result_additional, }; enum { - f_console_type_normal, + f_console_type_normal = 1, f_console_type_inverse, f_console_type_other, }; diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index 9d9883f..7d2ea3e 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -61,7 +61,7 @@ extern "C" { #ifndef _di_f_fss_codes_ enum { - f_fss_basic, + f_fss_basic = 1, f_fss_extended, f_fss_basic_list, f_fss_extended_list, diff --git a/level_0/f_socket/c/socket.h b/level_0/f_socket/c/socket.h index 8ff8483..7dd3ff1 100644 --- a/level_0/f_socket/c/socket.h +++ b/level_0/f_socket/c/socket.h @@ -29,7 +29,7 @@ extern "C"{ #define f_socket_close_id unsigned short enum { - f_socket_close_fast, // As in close(); + f_socket_close_fast = 1, // As in close(); f_socket_close_read, // As in shutdown(, SHUT_RD); f_socket_close_write, // As in shutdown(, SHUT_WR); f_socket_close_read_write, // As in shutdown(, SHUT_RDWR); diff --git a/level_3/byte_dump/c/byte_dump.h b/level_3/byte_dump/c/byte_dump.h index d98f104..523d8a4 100644 --- a/level_3/byte_dump/c/byte_dump.h +++ b/level_3/byte_dump/c/byte_dump.h @@ -62,14 +62,14 @@ extern "C" { #ifndef _di_byte_dump_defines_ enum { - byte_dump_mode_hexidecimal, + byte_dump_mode_hexidecimal = 1, byte_dump_mode_octal, byte_dump_mode_binary, byte_dump_mode_decimal, }; enum { - byte_dump_presentation_normal, + byte_dump_presentation_normal = 1, byte_dump_presentation_simple, byte_dump_presentation_classic, }; diff --git a/level_3/firewall/c/firewall.h b/level_3/firewall/c/firewall.h index b7436ad..57e0f80 100644 --- a/level_3/firewall/c/firewall.h +++ b/level_3/firewall/c/firewall.h @@ -195,7 +195,7 @@ extern "C" { #define firewall_chain_delete_command_length 2 enum { - firewall_program_none, + firewall_program_none = 1, firewall_program_iptables, firewall_program_ip6tables, firewall_program_ip46tables,