tevent: Add tevent_req_oom
authorVolker Lendecke <vl@samba.org>
Sun, 19 Jun 2011 18:55:46 +0000 (20:55 +0200)
committerVolker Lendecke <vlendec@samba.org>
Mon, 20 Jun 2011 10:33:24 +0000 (12:33 +0200)
This is a replacement for tevent_req_nomem(NULL, req)

lib/tevent/tevent.h
lib/tevent/tevent_req.c

index 38a4a9c50378af6a41060043a0d24522feb2ce1b..8204a28fbed23f5b22660536ada55b6bfb63eea3 100644 (file)
@@ -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.
  *
index b0c9c57ddec72ddc9f499a82d2a01053158ef259..92697b7df958f71454c1ac623fc497c7672d5fe4 100644 (file)
@@ -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;
 }