ldb: Add handy macros for reporting error inside ldb module
authorAmitay Isaacs <amitay@gmail.com>
Tue, 15 Nov 2011 01:34:40 +0000 (12:34 +1100)
committerAmitay Isaacs <amitay@samba.org>
Thu, 17 Nov 2011 04:24:46 +0000 (05:24 +0100)
Pair-Programmed-With: Andrew Tridgell <tridge@samba.org>

Autobuild-User: Amitay Isaacs <amitay@samba.org>
Autobuild-Date: Thu Nov 17 05:24:46 CET 2011 on sn-devel-104

lib/ldb/include/ldb_module.h

index 2acd8f364bed37a68acd74149c714335c5ed9105..4ecddc4ab19e2475508900e38b2f5d71663ac043 100644 (file)
@@ -85,10 +85,12 @@ void ldb_debug_add(struct ldb_context *ldb, const char *fmt, ...) PRINTF_ATTRIBU
 void ldb_debug_end(struct ldb_context *ldb, enum ldb_debug_level level);
 
 #define ldb_error(ldb, ecode, reason) ldb_error_at(ldb, ecode, reason, __FILE__, __LINE__)
+#define ldb_module_error(module, ecode, reason) ldb_error_at(ldb_module_get_ctx(module), ecode, reason, __FILE__, __LINE__)
 
 #define ldb_oom(ldb) ldb_error(ldb, LDB_ERR_OPERATIONS_ERROR, "ldb out of memory")
 #define ldb_module_oom(module) ldb_oom(ldb_module_get_ctx(module))
 #define ldb_operr(ldb) ldb_error(ldb, LDB_ERR_OPERATIONS_ERROR, "operations error")
+#define ldb_module_operr(module) ldb_error(ldb_module_get_ctx(module), LDB_ERR_OPERATIONS_ERROR, "operations error")
 
 /* The following definitions come from lib/ldb/common/ldb.c  */