summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ldap_driver.c6
-rw-r--r--str.c7
-rw-r--r--util.h9
3 files changed, 12 insertions, 10 deletions
diff --git a/ldap_driver.c b/ldap_driver.c
index 44b4fca..39a9715 100644
--- a/ldap_driver.c
+++ b/ldap_driver.c
@@ -26,11 +26,7 @@
#include <dns/result.h>
#include "log.h"
-
-#define CHECK(op) \
- do { result = (op); \
- if (result != ISC_R_SUCCESS) goto cleanup; \
- } while (0)
+#include "util.h"
#define LDAPDB_MAGIC ISC_MAGIC('L', 'D', 'P', 'D')
#define VALID_LDAPDB(ldapdb) \
diff --git a/str.c b/str.c
index 4655320..d553c66 100644
--- a/str.c
+++ b/str.c
@@ -33,6 +33,7 @@
#include <string.h>
#include "str.h"
+#include "util.h"
#define IGNORE(expr) if (expr) return
@@ -40,11 +41,6 @@
#define ALLOC_BASE_SIZE 16
-#define CHECK(op) \
- do { result = (op); \
- if (result != ISC_R_SUCCESS) goto cleanup; \
- } while (0)
-
/* Custom string, these shouldn't use these directly */
struct ld_string {
@@ -74,6 +70,7 @@ str_alloc(ld_string_t *str, size_t len)
char *new_buffer;
REQUIRE(str != NULL);
+ REQUIRE(str->mctx != NULL);
IGNORE_R(str->allocated > len);
len++; /* Account for the last '\0'. */
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..83ef628
--- /dev/null
+++ b/util.h
@@ -0,0 +1,9 @@
+#ifndef _LD_UTIL_H_
+#define _LD_UTIL_H_
+
+#define CHECK(op) \
+ do { result = (op); \
+ if (result != ISC_R_SUCCESS) goto cleanup; \
+ } while (0)
+
+#endif /* !_LD_UTIL_H_ */