]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
uint: typedef globally but not more than once
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 22 Dec 2016 09:23:20 +0000 (10:23 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 22 Dec 2016 09:23:20 +0000 (10:23 +0100)
Before C11, repeating a typedef is forbidden, if taken strictly, and
some compiler versions even reject it.  On the other hand lru.h was
missing it, which wasn't noticed due to glibc's <sys/types.h> defining it.
Fixes https://gitlab.labs.nic.cz/knot/resolver/issues/114.

contrib/ucw/config.h
lib/defines.h

index 11234f56ff23d9fafeeb17c36b5a2ad4630b916e..5d3cb4fe2946228ebbe80deddae40f64d6b4058c 100644 (file)
@@ -38,7 +38,12 @@ typedef int32_t s32;                 /** Exactly 32 bits, signed **/
 typedef uint64_t u64;                  /** Exactly 64 bits, unsigned **/
 typedef int64_t s64;                   /** Exactly 64 bits, signed **/
 
+
+#ifndef uint /* Redefining typedef is a C11 feature. */
 typedef unsigned int uint;             /** A better pronounceable alias for `unsigned int` **/
+#define uint uint
+#endif
+
 typedef s64 timestamp_t;               /** Milliseconds since an unknown epoch **/
 
 // FIXME: This should be removed soon
index 0be6b2d202629eb7ad6c8cd5860fc00ea2af0dc4..40c5bcd9bfe3cd79a477fc83bdc0cd5c266adf81 100644 (file)
 #define KR_COLD
 #endif
 
+#ifndef uint /* Redefining typedef is a C11 feature. */
+typedef unsigned int uint;
+#define uint uint
+#endif
+
 /*
  * Error codes.
  */