From fd1656fbf27d6142365cb04aee762e85ff67ce9c Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 7 Dec 2019 23:50:27 +0000 Subject: [PATCH] Move atoi_safe() from editor.h to compat.h and #define Batoi atoi_safe They were the same thing so they might as well be in the same place. git-svn-id: https://svn.eduke32.com/eduke32@8374 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/include/editor.h --- source/build/include/compat.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/build/include/compat.h b/source/build/include/compat.h index e8303da8e..d17ac36ad 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -568,7 +568,10 @@ typedef FILE BFILE; // parsing the decimal representation of 0xffffffff, // 4294967295 -- long is signed, so strtol would // return LONG_MAX (== 0x7fffffff on 32-bit archs)) -#define Batoi(str) ((int32_t)strtol(str, NULL, 10)) + +static FORCE_INLINE int32_t atoi_safe(const char *str) { return (int32_t)Bstrtol(str, NULL, 10); } + +#define Batoi(x) atoi_safe(x) #define Batol(str) (strtol(str, NULL, 10)) #define Batof(str) (strtod(str, NULL))