aboutsummaryrefslogtreecommitdiff
path: root/sprinter-sexp.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-01-01 08:01:34 -0400
committerDavid Bremner <david@tethera.net>2022-01-18 08:08:22 -0400
commit417d202e642e0af0ef692e3ce250a6af985c7442 (patch)
tree8617b002f1883a834ecb37a4e28d46749268c1c5 /sprinter-sexp.c
parent78e6cf12c05222c324110aa1eb9df9d99baa91a1 (diff)
CLI: stash pointer to database in sprinter structs
We already use an allocated (and presumably open) database as a talloc context. Keeping the pointer in the allocated struct will allow us to e.g. interrogate the configuration in a sprinter function without threading the database all the way through the various levels of function.
Diffstat (limited to 'sprinter-sexp.c')
-rw-r--r--sprinter-sexp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sprinter-sexp.c b/sprinter-sexp.c
index 63b25428..e37cb1f9 100644
--- a/sprinter-sexp.c
+++ b/sprinter-sexp.c
@@ -207,7 +207,7 @@ sexp_separator (struct sprinter *sp)
}
struct sprinter *
-sprinter_sexp_create (const void *ctx, FILE *stream)
+sprinter_sexp_create (notmuch_database_t *db, FILE *stream)
{
static const struct sprinter_sexp template = {
.vtable = {
@@ -227,11 +227,12 @@ sprinter_sexp_create (const void *ctx, FILE *stream)
};
struct sprinter_sexp *res;
- res = talloc (ctx, struct sprinter_sexp);
+ res = talloc (db, struct sprinter_sexp);
if (! res)
return NULL;
*res = template;
+ res->vtable.notmuch = db;
res->stream = stream;
return &res->vtable;
}