]> Kevux Git Server - fll/commit
Update: redesign error codes
authorKevin Day <kevin@kevux.org>
Sat, 9 Jun 2012 04:19:00 +0000 (23:19 -0500)
committerKevin Day <kevin@kevux.org>
Sat, 9 Jun 2012 04:19:00 +0000 (23:19 -0500)
commit3546b5998806877a331ccc8e5da5fa05165c9896
treec0c33d1557b7620e116945b99ca8fca36ad61c02
parentda2b5e9d13d0895c929bae8f9963cc5a4a5e383d
Update: redesign error codes

This is a major rewrite of the error code system.

Previously, the error system did the following:
- used an unsigned short data type
- allowed for all 16 bits to be used
- because it was unsigned short, different architectures might have different size.
- it is rather inefficient and ugly to check for errors when there may be as many as 30 different error codes to compare against.

The new error system does the following:
- enforce exactly 16-bit unsigned integer by using uint16_t.
- reserves the first two high order bits in the following manner:
  - bit 1 = error bit (1000 0000 0000 0000)
  - bit 2 = warning bit (0100 0000 0000 0000)
  - (note setting both bit 1 and bit 2 is unsupported)
- provide a series of macros to quickly detect and manage the new bits
- limits the total available number of error codes to 14-bits instead of 16-bits

The advantage of the new system is that what the status code is can be detected in one or two conditionals (using bitwise operations).
This should speed up performance and make the code easier to read.
59 files changed:
level_0/f_console/c/console.c
level_0/f_conversion/c/conversion.c
level_0/f_conversion/c/conversion.h
level_0/f_errors/c/errors.h
level_0/f_file/c/file.c
level_0/f_file/c/file.h
level_0/f_memory/c/memory.c
level_0/f_memory/c/memory.h
level_0/f_output/c/output.c
level_0/f_output/c/output.h
level_0/f_pipe/c/pipe.c
level_0/f_pipe/c/pipe.h
level_0/f_serialized/c/serialized.h
level_0/f_types/c/types.h
level_1/fl_colors/c/colors.c
level_1/fl_console/c/console.c
level_1/fl_console/c/console.h
level_1/fl_directory/c/directory.c
level_1/fl_directory/c/directory.h
level_1/fl_errors/c/errors.c
level_1/fl_errors/c/errors.h
level_1/fl_file/c/file.c
level_1/fl_fss/c/fss.c
level_1/fl_fss/c/fss.h
level_1/fl_fss/c/fss_basic.c
level_1/fl_fss/c/fss_basic.h
level_1/fl_fss/c/fss_basic_list.c
level_1/fl_fss/c/fss_basic_list.h
level_1/fl_fss/c/fss_extended.c
level_1/fl_fss/c/fss_extended.h
level_1/fl_fss/c/fss_macro.h
level_1/fl_serialized/c/serialized.c
level_1/fl_serialized/c/serialized.h
level_1/fl_strings/c/strings.c
level_1/fl_strings/c/strings.h
level_2/fll_colors/c/colors.c
level_2/fll_colors/c/colors.h
level_2/fll_execute/c/execute.c
level_2/fll_execute/c/execute.h
level_2/fll_fss/c/fss_basic.c
level_2/fll_fss/c/fss_basic.h
level_2/fll_fss/c/fss_basic_list.c
level_2/fll_fss/c/fss_basic_list.h
level_2/fll_fss/c/fss_errors.c
level_2/fll_fss/c/fss_errors.h
level_2/fll_fss/c/fss_extended.c
level_2/fll_fss/c/fss_extended.h
level_3/firewall/c/firewall.c
level_3/firewall/c/private-firewall.c
level_3/fss_basic_list_read/c/fss_basic_list_read.c
level_3/fss_basic_list_write/c/fss_basic_list_write.c
level_3/fss_basic_read/c/fss_basic_read.c
level_3/fss_basic_write/c/fss_basic_write.c
level_3/fss_extended_read/c/fss_extended_read.c
level_3/fss_extended_write/c/fss_extended_write.c
level_3/fss_return_code/c/fss_return_code.c
level_3/fss_return_code/c/fss_return_code.h
level_3/return_code/c/return_code.c
level_3/return_code/c/return_code.h