adb9c9
From b533d722fa62232955aedfdf1bbc0179f48497eb Mon Sep 17 00:00:00 2001
adb9c9
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
adb9c9
Date: Thu, 1 Mar 2018 19:41:10 +0100
adb9c9
Subject: [PATCH] Support for BIND 9.11.3. Include explicitly isc/util.h in
adb9c9
 each file that uses REQUIRE(). Support stdatomic feature, do not use function
adb9c9
 call in STATIC_ASSERT().
adb9c9
adb9c9
---
adb9c9
 src/bindcfg.c      |  1 +
adb9c9
 src/fwd_register.c |  1 +
adb9c9
 src/ldap_entry.h   | 11 +++++------
adb9c9
 src/mldap.c        |  4 ++--
adb9c9
 src/rbt_helper.c   |  1 +
adb9c9
 src/types.h        |  2 +-
adb9c9
 6 files changed, 11 insertions(+), 9 deletions(-)
adb9c9
adb9c9
diff --git a/src/bindcfg.c b/src/bindcfg.c
adb9c9
index 9b429ba..5539dea 100644
adb9c9
--- a/src/bindcfg.c
adb9c9
+++ b/src/bindcfg.c
adb9c9
@@ -6,6 +6,7 @@
adb9c9
 
adb9c9
 #include "config.h"
adb9c9
 
adb9c9
+#include <isc/util.h>
adb9c9
 #include <isccfg/grammar.h>
adb9c9
 #include <isccfg/namedconf.h>
adb9c9
 
adb9c9
diff --git a/src/fwd_register.c b/src/fwd_register.c
adb9c9
index 355d15f..7cc0c5a 100644
adb9c9
--- a/src/fwd_register.c
adb9c9
+++ b/src/fwd_register.c
adb9c9
@@ -3,6 +3,7 @@
adb9c9
  */
adb9c9
 
adb9c9
 #include <isc/rwlock.h>
adb9c9
+#include <isc/util.h>
adb9c9
 #include <dns/name.h>
adb9c9
 
adb9c9
 #include "rbt_helper.h"
adb9c9
diff --git a/src/ldap_entry.h b/src/ldap_entry.h
adb9c9
index 6498c79..88b1c42 100644
adb9c9
--- a/src/ldap_entry.h
adb9c9
+++ b/src/ldap_entry.h
adb9c9
@@ -6,7 +6,6 @@
adb9c9
 #define _LD_LDAP_ENTRY_H_
adb9c9
 
adb9c9
 #include <isc/lex.h>
adb9c9
-#include <isc/util.h>
adb9c9
 #include <dns/types.h>
adb9c9
 
adb9c9
 #include "fwd_register.h"
adb9c9
@@ -19,15 +18,15 @@
adb9c9
 
adb9c9
 /* Represents values associated with LDAP attribute */
adb9c9
 typedef struct ldap_value ldap_value_t;
adb9c9
-typedef LIST(ldap_value_t) ldap_valuelist_t;
adb9c9
+typedef ISC_LIST(ldap_value_t) ldap_valuelist_t;
adb9c9
 struct ldap_value {
adb9c9
         char                    *value;
adb9c9
-        LINK(ldap_value_t)      link;
adb9c9
+        ISC_LINK(ldap_value_t)      link;
adb9c9
 };
adb9c9
 
adb9c9
 /* Represents LDAP attribute and it's values */
adb9c9
 typedef struct ldap_attribute	ldap_attribute_t;
adb9c9
-typedef LIST(ldap_attribute_t)	ldap_attributelist_t;
adb9c9
+typedef ISC_LIST(ldap_attribute_t)	ldap_attributelist_t;
adb9c9
 
adb9c9
 /* Represents LDAP entry and it's attributes */
adb9c9
 typedef unsigned char		ldap_entryclass_t;
adb9c9
@@ -41,7 +40,7 @@ struct ldap_entry {
adb9c9
 
adb9c9
 	ldap_attribute_t	*lastattr;
adb9c9
 	ldap_attributelist_t	attrs;
adb9c9
-	LINK(ldap_entry_t)	link;
adb9c9
+	ISC_LINK(ldap_entry_t)	link;
adb9c9
 
adb9c9
 	/* Parsing. */
adb9c9
 	isc_lex_t		*lex;
adb9c9
@@ -59,7 +58,7 @@ struct ldap_attribute {
adb9c9
 	char			**ldap_values;
adb9c9
 	ldap_value_t		*lastval;
adb9c9
 	ldap_valuelist_t	values;
adb9c9
-	LINK(ldap_attribute_t)	link;
adb9c9
+	ISC_LINK(ldap_attribute_t)	link;
adb9c9
 };
adb9c9
 
adb9c9
 #define LDAP_ENTRYCLASS_NONE	0x0
adb9c9
diff --git a/src/mldap.c b/src/mldap.c
adb9c9
index 143abce..304ba36 100644
adb9c9
--- a/src/mldap.c
adb9c9
+++ b/src/mldap.c
adb9c9
@@ -119,13 +119,13 @@ void mldap_cur_generation_bump(mldapdb_t *mldap) {
adb9c9
  * reference counter value.
adb9c9
  */
adb9c9
 STATIC_ASSERT((isc_uint32_t)
adb9c9
-		(typeof(isc_refcount_current((isc_refcount_t *)0)))
adb9c9
+		(typeof(((isc_refcount_t *)0)->refs))
adb9c9
 		-1
adb9c9
 	      == 0xFFFFFFFF, \
adb9c9
 	      "negative isc_refcount_t cannot be properly shortened to 32 bits");
adb9c9
 
adb9c9
 STATIC_ASSERT((isc_uint32_t)
adb9c9
-		(typeof(isc_refcount_current((isc_refcount_t *)0)))
adb9c9
+		(typeof(((isc_refcount_t *)0)->refs))
adb9c9
 		0x90ABCDEF12345678
adb9c9
 	      == 0x12345678, \
adb9c9
 	      "positive isc_refcount_t cannot be properly shortened to 32 bits");
adb9c9
diff --git a/src/rbt_helper.c b/src/rbt_helper.c
adb9c9
index 2a7e6cb..f610b07 100644
adb9c9
--- a/src/rbt_helper.c
adb9c9
+++ b/src/rbt_helper.c
adb9c9
@@ -2,6 +2,7 @@
adb9c9
  * Copyright (C) 2013-2014  bind-dyndb-ldap authors; see COPYING for license
adb9c9
  */
adb9c9
 
adb9c9
+#include <isc/util.h>
adb9c9
 #include <dns/rbt.h>
adb9c9
 
adb9c9
 #include "util.h"
adb9c9
diff --git a/src/types.h b/src/types.h
adb9c9
index 25ef3b9..01d627c 100644
adb9c9
--- a/src/types.h
adb9c9
+++ b/src/types.h
adb9c9
@@ -24,7 +24,7 @@
adb9c9
  * rdata1 -> rdata2 -> rdata3           rdata4 -> rdata5
adb9c9
  * next_rdatalist              ->       next_rdatalist  ...
adb9c9
  */
adb9c9
-typedef LIST(dns_rdatalist_t) ldapdb_rdatalist_t;
adb9c9
+typedef ISC_LIST(dns_rdatalist_t) ldapdb_rdatalist_t;
adb9c9
 
adb9c9
 typedef struct enum_txt_assoc {
adb9c9
 	int		value;
adb9c9
-- 
adb9c9
2.14.3
adb9c9