summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-06-19 20:55:46 +0200
committerVolker Lendecke <vlendec@samba.org>2011-06-20 12:33:24 +0200
commitc2a826b10c403e1b4d7e6da1b41c89ed01d07f40 (patch)
tree0b4d34a6123044432982bd087c60f4b5608fb78b
parent580fedc321d0a7a11454ad633736101050ef13df (diff)
downloadsamba-c2a826b10c403e1b4d7e6da1b41c89ed01d07f40.tar.gz
samba-c2a826b10c403e1b4d7e6da1b41c89ed01d07f40.tar.xz
samba-c2a826b10c403e1b4d7e6da1b41c89ed01d07f40.zip
tevent: Add tevent_req_oom
This is a replacement for tevent_req_nomem(NULL, req)
-rw-r--r--lib/tevent/tevent.h14
-rw-r--r--lib/tevent/tevent_req.c7
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 38a4a9c5037..8204a28fbed 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -995,6 +995,20 @@ bool _tevent_req_nomem(const void *p,
_tevent_req_nomem(p, req, __location__)
#endif
+#ifdef DOXYGEN
+/**
+ * @brief Indicate out of memory to a request
+ *
+ * @param[in] req The request being processed.
+ */
+void tevent_req_oom(struct tevent_req *req);
+#else
+void _tevent_req_oom(struct tevent_req *req,
+ const char *location);
+#define tevent_req_oom(req) \
+ _tevent_req_oom(req, __location__)
+#endif
+
/**
* @brief Finish a request before the caller had the change to set the callback.
*
diff --git a/lib/tevent/tevent_req.c b/lib/tevent/tevent_req.c
index b0c9c57ddec..92697b7df95 100644
--- a/lib/tevent/tevent_req.c
+++ b/lib/tevent/tevent_req.c
@@ -123,6 +123,11 @@ bool _tevent_req_error(struct tevent_req *req,
return true;
}
+void _tevent_req_oom(struct tevent_req *req, const char *location)
+{
+ tevent_req_finish(req, TEVENT_REQ_NO_MEMORY, location);
+}
+
bool _tevent_req_nomem(const void *p,
struct tevent_req *req,
const char *location)
@@ -130,7 +135,7 @@ bool _tevent_req_nomem(const void *p,
if (p != NULL) {
return false;
}
- tevent_req_finish(req, TEVENT_REQ_NO_MEMORY, location);
+ _tevent_req_oom(req, location);
return true;
}