[esnacc-dev] [RFC PATCH 2/4] asn-config: use definitions from stdint

Aaron Conole aconole at bytheb.org
Tue Aug 7 17:36:55 UTC 2018


4-byte integral types are defined in the standard to exist in stdint.h, so
there is no need to use a strange ifdef construct.

Signed-off-by: Aaron Conole <aconole at redhat.com>
---
 cxx-lib/inc/asn-config.h | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/cxx-lib/inc/asn-config.h b/cxx-lib/inc/asn-config.h
index 6e5045f..979bc50 100644
--- a/cxx-lib/inc/asn-config.h
+++ b/cxx-lib/inc/asn-config.h
@@ -132,6 +132,7 @@
 #ifndef _asn_config_h_
 #define _asn_config_h_
 
+#include <stdint.h>
 #ifndef WIN32
 #include <stdlib.h> /* for wchar_t on UNIX */
 #endif
@@ -166,24 +167,9 @@
 #define USE_EXP_BUF 1
 
 // used not only by AsnInt (asn-int.h), but by AsnNameDesc (meta.h) as well:
-#if SIZEOF_INT == 4
-#  define I		int
-#else
-#  if SIZEOF_LONG == 4
-#    define I		long
-#  elif SIZEOF_SHORT == 4
-#      define I		short
-#  else
-#    define I int
-#  endif
-#endif
-#ifdef I
-  typedef I		AsnIntType;
-  typedef unsigned I	AsnUIntType;
-#  undef I
-#else
-#  error "can't find integer type which is 4 bytes in size"
-#endif
+
+typedef int32_t  AsnIntType;
+typedef uint32_t AsnUIntType;
 
 /* used to test if optionals are present */
 #define NOT_NULL( ptr)		((ptr) != NULL)
-- 
2.14.3



More information about the dev mailing list