Skip to content
Snippets Groups Projects
Commit 74786cc5 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

Merge !106: uint: typedef globally but not more than once

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.
parents 890be5e0 bb21450f
1 merge request!106uint: typedef globally but not more than once
...@@ -38,7 +38,12 @@ typedef int32_t s32; /** Exactly 32 bits, signed **/ ...@@ -38,7 +38,12 @@ typedef int32_t s32; /** Exactly 32 bits, signed **/
typedef uint64_t u64; /** Exactly 64 bits, unsigned **/ typedef uint64_t u64; /** Exactly 64 bits, unsigned **/
typedef int64_t s64; /** Exactly 64 bits, signed **/ 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` **/ typedef unsigned int uint; /** A better pronounceable alias for `unsigned int` **/
#define uint uint
#endif
typedef s64 timestamp_t; /** Milliseconds since an unknown epoch **/ typedef s64 timestamp_t; /** Milliseconds since an unknown epoch **/
// FIXME: This should be removed soon // FIXME: This should be removed soon
......
...@@ -36,6 +36,11 @@ ...@@ -36,6 +36,11 @@
#define KR_COLD #define KR_COLD
#endif #endif
#ifndef uint /* Redefining typedef is a C11 feature. */
typedef unsigned int uint;
#define uint uint
#endif
/* /*
* Error codes. * Error codes.
*/ */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment