From 2ebbc92688ec061cefd3ec374f2e4c2937e330f9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 8 Dec 2023 03:54:37 +0000 Subject: xap_helper: support term length limit 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) --- lib/PublicInbox/xap_helper.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/xap_helper.h') 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 + size_t *lenv; // -A 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]) -- cgit v1.2.3-24-ge0c7