[PATCH v3 01/15] crypto: rename notmuch_crypto_t to _notmuch_crypto_t

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Oct 9 22:49:02 PDT 2017


The notmuch_crypto_t struct isn't used externally, and we have no
plans to explicitly export it.  Prefix its name (and associated
functions) with _ to make that intent clear.
---
 crypto.c         | 12 ++++++------
 mime-node.c      |  6 +++---
 notmuch-client.h | 12 ++++++------
 notmuch-reply.c  |  2 +-
 notmuch-show.c   |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/crypto.c b/crypto.c
index 9c557d6e..9ae303d4 100644
--- a/crypto.c
+++ b/crypto.c
@@ -22,7 +22,7 @@
 #if (GMIME_MAJOR_VERSION < 3)
 /* Create a GPG context (GMime 2.6) */
 static notmuch_crypto_context_t *
-create_gpg_context (notmuch_crypto_t *crypto)
+create_gpg_context (_notmuch_crypto_t *crypto)
 {
     notmuch_crypto_context_t *gpgctx;
 
@@ -45,7 +45,7 @@ create_gpg_context (notmuch_crypto_t *crypto)
 
 /* Create a PKCS7 context (GMime 2.6) */
 static notmuch_crypto_context_t *
-create_pkcs7_context (notmuch_crypto_t *crypto)
+create_pkcs7_context (_notmuch_crypto_t *crypto)
 {
     notmuch_crypto_context_t *pkcs7ctx;
 
@@ -67,7 +67,7 @@ create_pkcs7_context (notmuch_crypto_t *crypto)
 }
 static const struct {
     const char *protocol;
-    notmuch_crypto_context_t *(*get_context) (notmuch_crypto_t *crypto);
+    notmuch_crypto_context_t *(*get_context) (_notmuch_crypto_t *crypto);
 } protocols[] = {
     {
 	.protocol = "application/pgp-signature",
@@ -90,7 +90,7 @@ static const struct {
 /* for the specified protocol return the context pointer (initializing
  * if needed) */
 notmuch_crypto_context_t *
-notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol)
+_notmuch_crypto_get_context (_notmuch_crypto_t *crypto, const char *protocol)
 {
     notmuch_crypto_context_t *cryptoctx = NULL;
     size_t i;
@@ -118,7 +118,7 @@ notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol)
 }
 
 int
-notmuch_crypto_cleanup (notmuch_crypto_t *crypto)
+_notmuch_crypto_cleanup (_notmuch_crypto_t *crypto)
 {
     if (crypto->gpgctx) {
 	g_object_unref (crypto->gpgctx);
@@ -133,7 +133,7 @@ notmuch_crypto_cleanup (notmuch_crypto_t *crypto)
     return 0;
 }
 #else
-int notmuch_crypto_cleanup (unused(notmuch_crypto_t *crypto))
+int _notmuch_crypto_cleanup (unused(_notmuch_crypto_t *crypto))
 {
     return 0;
 }
diff --git a/mime-node.c b/mime-node.c
index 8b767d78..56187746 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -33,7 +33,7 @@ typedef struct mime_node_context {
     GMimeMessage *mime_message;
 
     /* Context provided by the caller. */
-    notmuch_crypto_t *crypto;
+    _notmuch_crypto_t *crypto;
 } mime_node_context_t;
 
 static int
@@ -56,7 +56,7 @@ _mime_node_context_free (mime_node_context_t *res)
 
 notmuch_status_t
 mime_node_open (const void *ctx, notmuch_message_t *message,
-		notmuch_crypto_t *crypto, mime_node_t **root_out)
+		_notmuch_crypto_t *crypto, mime_node_t **root_out)
 {
     const char *filename = notmuch_message_get_filename (message);
     mime_node_context_t *mctx;
@@ -265,7 +265,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
 	|| (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify)) {
 	GMimeContentType *content_type = g_mime_object_get_content_type (part);
 	const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol");
-	cryptoctx = notmuch_crypto_get_context (node->ctx->crypto, protocol);
+	cryptoctx = _notmuch_crypto_get_context (node->ctx->crypto, protocol);
 	if (!cryptoctx)
 	    return NULL;
     }
diff --git a/notmuch-client.h b/notmuch-client.h
index 0365baae..224912c5 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -72,7 +72,7 @@ typedef struct notmuch_show_format {
 			      const struct notmuch_show_params *params);
 } notmuch_show_format_t;
 
-typedef struct notmuch_crypto {
+typedef struct _notmuch_crypto {
     bool verify;
     bool decrypt;
 #if (GMIME_MAJOR_VERSION < 3)
@@ -80,14 +80,14 @@ typedef struct notmuch_crypto {
     notmuch_crypto_context_t* pkcs7ctx;
     const char *gpgpath;
 #endif
-} notmuch_crypto_t;
+} _notmuch_crypto_t;
 
 typedef struct notmuch_show_params {
     bool entire_thread;
     bool omit_excluded;
     bool output_body;
     int part;
-    notmuch_crypto_t crypto;
+    _notmuch_crypto_t crypto;
     bool include_html;
     GMimeStream *out_stream;
 } notmuch_show_params_t;
@@ -183,11 +183,11 @@ notmuch_exit_if_unsupported_format (void);
 
 #if (GMIME_MAJOR_VERSION <3)
 notmuch_crypto_context_t *
-notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol);
+_notmuch_crypto_get_context (_notmuch_crypto_t *crypto, const char *protocol);
 #endif
 
 int
-notmuch_crypto_cleanup (notmuch_crypto_t *crypto);
+_notmuch_crypto_cleanup (_notmuch_crypto_t *crypto);
 
 int
 notmuch_count_command (notmuch_config_t *config, int argc, char *argv[]);
@@ -449,7 +449,7 @@ struct mime_node {
  */
 notmuch_status_t
 mime_node_open (const void *ctx, notmuch_message_t *message,
-		notmuch_crypto_t *crypto, mime_node_t **node_out);
+		_notmuch_crypto_t *crypto, mime_node_t **node_out);
 
 /* Return a new MIME node for the requested child part of parent.
  * parent will be used as the talloc context for the returned child
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 3e5a1443..2c7cc4eb 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -759,7 +759,7 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
     if (do_reply (config, query, &params, format, reply_all) != 0)
 	return EXIT_FAILURE;
 
-    notmuch_crypto_cleanup (&params.crypto);
+    _notmuch_crypto_cleanup (&params.crypto);
     notmuch_query_destroy (query);
     notmuch_database_destroy (notmuch);
 
diff --git a/notmuch-show.c b/notmuch-show.c
index 1cfc7465..7afd3947 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1234,7 +1234,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
     g_mime_stream_flush (params.out_stream);
     g_object_unref (params.out_stream);
 
-    notmuch_crypto_cleanup (&params.crypto);
+    _notmuch_crypto_cleanup (&params.crypto);
     notmuch_query_destroy (query);
     notmuch_database_destroy (notmuch);
 
-- 
2.14.2



More information about the notmuch mailing list