diff options
| author | David Bremner <david@tethera.net> | 2022-01-01 08:01:34 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-01-18 08:08:22 -0400 |
| commit | 417d202e642e0af0ef692e3ce250a6af985c7442 (patch) | |
| tree | 8617b002f1883a834ecb37a4e28d46749268c1c5 /sprinter.h | |
| parent | 78e6cf12c05222c324110aa1eb9df9d99baa91a1 (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.h')
| -rw-r--r-- | sprinter.h | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -9,6 +9,11 @@ * (strings, integers and booleans). */ typedef struct sprinter { + /* + * Open notmuch database + */ + notmuch_database_t *notmuch; + /* Start a new map/dictionary structure. This should be followed by * a sequence of alternating calls to map_key and one of the * value-printing functions until the map is ended by end. @@ -65,20 +70,20 @@ typedef struct sprinter { /* Create a new unstructured printer that emits the default text format * for "notmuch search". */ struct sprinter * -sprinter_text_create (const void *ctx, FILE *stream); +sprinter_text_create (notmuch_database_t *db, FILE *stream); /* Create a new unstructured printer that emits the text format for * "notmuch search", with each field separated by a null character * instead of the newline character. */ struct sprinter * -sprinter_text0_create (const void *ctx, FILE *stream); +sprinter_text0_create (notmuch_database_t *db, FILE *stream); /* Create a new structure printer that emits JSON. */ struct sprinter * -sprinter_json_create (const void *ctx, FILE *stream); +sprinter_json_create (notmuch_database_t *db, FILE *stream); /* Create a new structure printer that emits S-Expressions. */ struct sprinter * -sprinter_sexp_create (const void *ctx, FILE *stream); +sprinter_sexp_create (notmuch_database_t *db, FILE *stream); #endif // NOTMUCH_SPRINTER_H |
