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

Message ID 20180807173657.7572-3-aconole@bytheb.org
State New
Delegated to: Aaron Conole
Headers show
Series
  • Fix a number of broken functionalities from 1.8
Related show

Commit Message

Aaron Conole Aug. 7, 2018, 5:36 p.m.
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@redhat.com>
---
 cxx-lib/inc/asn-config.h | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

Patch

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)