unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: [PATCH 4/5] cli/dump: define GZPUTS and use it in notmuch-dump
Date: Sun, 12 Apr 2020 23:10:15 -0300	[thread overview]
Message-ID: <20200413021016.2799496-5-david@tethera.net> (raw)
In-Reply-To: <20200413021016.2799496-1-david@tethera.net>

Similarly to GZPRINTF, this is a drop in replacement that can be
improved where needd.
---
 notmuch-client.h |  1 +
 notmuch-dump.c   | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 55d4d526..7efcb06f 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -499,6 +499,7 @@ print_status_gzbytes (const char *loc,
 
 #define ASSERT_GZBYTES(file, bytes) ( (print_status_gzbytes(__location__, file, bytes)) ?  exit(1) : 0 )
 #define GZPRINTF(file, fmt, ...) ASSERT_GZBYTES(file, gzprintf (file, fmt, ##__VA_ARGS__));
+#define GZPUTS(file, str) ASSERT_GZBYTES(file, gzputs (file, str));
 
 #include "command-line-arguments.h"
 
diff --git a/notmuch-dump.c b/notmuch-dump.c
index ca45d885..fb322237 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -76,7 +76,7 @@ print_dump_header (gzFile output, int output_format, int include)
 	      NOTMUCH_DUMP_VERSION);
 
     if (include & DUMP_INCLUDE_CONFIG) {
-	gzputs (output, "config");
+	GZPUTS (output, "config");
 	sep = ",";
     }
     if (include & DUMP_INCLUDE_PROPERTIES) {
@@ -86,7 +86,7 @@ print_dump_header (gzFile output, int output_format, int include)
     if (include & DUMP_INCLUDE_TAGS) {
 	GZPRINTF (output, "%stags", sep);
     }
-    gzputs (output, "\n");
+    GZPUTS (output, "\n");
 }
 
 static int
@@ -174,12 +174,12 @@ dump_tags_message (void *ctx,
 	const char *tag_str = notmuch_tags_get (tags);
 
 	if (! first)
-	    gzputs (output, " ");
+	    GZPUTS (output, " ");
 
 	first = 0;
 
 	if (output_format == DUMP_FORMAT_SUP) {
-	    gzputs (output, tag_str);
+	    GZPUTS (output, tag_str);
 	} else {
 	    if (hex_encode (ctx, tag_str,
 			    buffer_p, size_p) != HEX_SUCCESS) {
@@ -192,7 +192,7 @@ dump_tags_message (void *ctx,
     }
 
     if (output_format == DUMP_FORMAT_SUP) {
-	gzputs (output, ")\n");
+	GZPUTS (output, ")\n");
     } else {
 	if (make_boolean_term (ctx, "id", message_id,
 			       buffer_p, size_p)) {
-- 
2.25.1

  parent reply	other threads:[~2020-04-13  2:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-12 17:34 [PATCH] test: add known_broken test for dumping large stored queries David Bremner
2020-04-12 20:39 ` David Bremner
2020-04-13  2:10 ` David Bremner
2020-04-13  2:10   ` [PATCH 1/5] util/zlib-extra.c: don't pass NULL to gzerror David Bremner
2020-04-13  2:10   ` [PATCH 2/5] status: add print_status_gzbytes David Bremner
2020-04-13  2:10   ` [PATCH 3/5] cli/dump: define GZPRINTF macro and use it in place of gzprintf David Bremner
2020-04-13  8:52     ` Tomi Ollila
2020-04-13 11:21       ` David Bremner
2020-04-13 11:37         ` David Bremner
2020-04-13  2:10   ` David Bremner [this message]
2020-04-13  2:10   ` [PATCH 5/5] cli/dump: replace use of gzprintf with gzputs for config values David Bremner
2020-04-13  8:47 ` [PATCH] test: add known_broken test for dumping large stored queries Tomi Ollila
2020-04-13  9:43 ` Thomas Schneider
2020-04-13 12:36   ` [PATCH 1/6] " David Bremner
2020-04-13 12:36     ` [PATCH 2/6] util/zlib-extra.c: don't pass NULL to gzerror David Bremner
2020-04-13 12:36     ` [PATCH 3/6] status: add print_status_gzbytes David Bremner
2020-04-13 12:36     ` [PATCH 4/6] cli/dump: define GZPRINTF macro and use it in place of gzprintf David Bremner
2020-04-13 14:12       ` Tomi Ollila
2020-04-13 12:36     ` [PATCH 5/6] cli/dump: define GZPUTS and use it in notmuch-dump David Bremner
2020-04-13 12:36     ` [PATCH 6/6] cli/dump: replace use of gzprintf with gzputs for config values David Bremner
2020-04-13 23:03     ` [PATCH 1/6] test: add known_broken test for dumping large stored queries David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200413021016.2799496-5-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).