From 16a66f19e10b85e5adc4b0c72de07cbd8dd2159f Mon Sep 17 00:00:00 2001 From: mc78 <mc78@outlook.de> Date: Fri, 15 Nov 2019 16:35:58 +0100 Subject: [PATCH] Replaced enum in cc65.h by defines. added comment that cc65 exit constants should not redefine 0 and 1 as they are reserved for exit_success and exit_failure --- include/cc65.h | 13 +++++++------ libsrc/dbg/dbg.c | 3 +-- libsrc/geos-apple/targetutil/convert.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/cc65.h b/include/cc65.h index 99a8665c8..95de8e4ab 100644 --- a/include/cc65.h +++ b/include/cc65.h @@ -36,12 +36,13 @@ #ifndef _CC65_H #define _CC65_H -typedef enum { - CC65_EXIT_SUCCESS, - CC65_EXIT_FAILURE, - CC65_EXIT_AFAILED, - CC65_EXIT_ABORT -} cc65_exit_codes_t; + +/* Those cc65 exit constants definitions are in addition the the + constants defined in stdlib.h. The values 0 and 1 are still + reserved for EXIT_SUCCESS and EXIT_FAILURE and should not be + redefined */ +#define CC65_EXIT_AFAILED 2 +#define CC65_EXIT_ABORT 3 /*****************************************************************************/ diff --git a/libsrc/dbg/dbg.c b/libsrc/dbg/dbg.c index a58e6c7a6..a6f952f35 100644 --- a/libsrc/dbg/dbg.c +++ b/libsrc/dbg/dbg.c @@ -14,7 +14,6 @@ #include <ctype.h> #include <6502.h> #include <dbg.h> -#include <cc65.h> /*****************************************************************************/ @@ -1583,7 +1582,7 @@ void DbgEntry (void) /* Exit intentionally with error because one may say that DbgEntry is always abnormal. */ - exit (CC65_EXIT_FAILURE); + exit (EXIT_FAILURE); } } diff --git a/libsrc/geos-apple/targetutil/convert.c b/libsrc/geos-apple/targetutil/convert.c index a4d07ac0a..7798e004d 100644 --- a/libsrc/geos-apple/targetutil/convert.c +++ b/libsrc/geos-apple/targetutil/convert.c @@ -70,7 +70,7 @@ static void err_exit(char *operation, unsigned char oserr) operation); } getchar(); - exit(CC65_EXIT_FAILURE); + exit(EXIT_FAILURE); } @@ -343,5 +343,5 @@ int main(int argc, char* argv[]) printf("Convert to '%.*s' successful", dir_entry->storage_length.name_length, dir_entry->file_name); getchar(); - return CC65_EXIT_SUCCESS; + return EXIT_SUCCESS; }