about summary refs log tree commit homepage
path: root/lib/PublicInbox/xap_helper.h
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-12-08 03:54:37 +0000
committerEric Wong <e@80x24.org>2023-12-09 02:03:51 +0000
commit2ebbc92688ec061cefd3ec374f2e4c2937e330f9 (patch)
tree511d54fb76dc5a264f0e682cb039c3c214ae1c3f /lib/PublicInbox/xap_helper.h
parent352c78a9a1ec3bfc6743b3217aa5964aa09a3829 (diff)
downloadpublic-inbox-2ebbc92688ec061cefd3ec374f2e4c2937e330f9.tar.gz
This will allow us to use p2q-compatible specifications such as
"dfpost7" to only capture blob OIDs which are 7 characters in
length (the indexer will always index down to 7 characters)
Diffstat (limited to 'lib/PublicInbox/xap_helper.h')
-rw-r--r--lib/PublicInbox/xap_helper.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h
index 1f8c426b..3456910b 100644
--- a/lib/PublicInbox/xap_helper.h
+++ b/lib/PublicInbox/xap_helper.h
@@ -123,6 +123,7 @@ typedef bool (*cmd)(struct req *);
 struct req { // argv and pfxv point into global rbuf
         char *argv[MY_ARG_MAX];
         char *pfxv[MY_ARG_MAX]; // -A <prefix>
+        size_t *lenv; // -A <prefix>LENGTH
         struct srch *srch;
         char *Pgit_dir;
         char *Oeidx_key;
@@ -727,6 +728,13 @@ static void sigw(int sig) // SIGTERM handler for worker
         sock_fd = -1; // break out of recv_loop
 }
 
+#define CLEANUP_REQ __attribute__((__cleanup__(req_cleanup)))
+static void req_cleanup(void *ptr)
+{
+        struct req *req = (struct req *)ptr;
+        free(req->lenv);
+}
+
 static void recv_loop(void) // worker process loop
 {
         static char rbuf[4096 * 33]; // per-process
@@ -737,7 +745,8 @@ static void recv_loop(void) // worker process loop
 
         while (sock_fd == 0) {
                 size_t len = sizeof(rbuf);
-                struct req req = {};
+                CLEANUP_REQ struct req req = {};
+
                 if (!recv_req(&req, rbuf, &len))
                         continue;
                 if (req.fp[1])