unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] lib: remove enum names from typedefs
@ 2021-10-13 14:02 Jani Nikula
  2021-10-13 14:02 ` [PATCH 2/2] cli: " Jani Nikula
  2021-10-23 11:42 ` [PATCH 1/2] lib: " David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Jani Nikula @ 2021-10-13 14:02 UTC (permalink / raw)
  To: notmuch; +Cc: jani

There are some enum typedefs with the enum name:

    typedef enum _name_t { ... } name_t;

We don't need or use the enum names _name_t for anything, and not all
of the enum typedefs have them. We have the typedefs specifically to
use the typedef name.

Use the anonymous enum in the typedefs:

    typedef enum { ... } name_t;
---
 lib/database-private.h | 2 +-
 lib/notmuch-private.h  | 4 ++--
 lib/notmuch.h          | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/database-private.h b/lib/database-private.h
index 8b9d67feec70..7a0450515f44 100644
--- a/lib/database-private.h
+++ b/lib/database-private.h
@@ -160,7 +160,7 @@ operator&= (_notmuch_features &a, _notmuch_features b)
 
 /*
  * Configuration options for xapian database fields */
-typedef enum notmuch_field_flags {
+typedef enum {
     NOTMUCH_FIELD_NO_FLAGS	= 0,
     NOTMUCH_FIELD_EXTERNAL	= 1 << 0,
     NOTMUCH_FIELD_PROBABILISTIC = 1 << 1,
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 093c29b1bbc5..e9ce74a4b178 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -121,7 +121,7 @@ typedef enum {
  */
 #define NOTMUCH_MESSAGE_ID_MAX (200 - sizeof (NOTMUCH_METADATA_THREAD_ID_PREFIX))
 
-typedef enum _notmuch_private_status {
+typedef enum {
     /* First, copy all the public status values. */
     NOTMUCH_PRIVATE_STATUS_SUCCESS			= NOTMUCH_STATUS_SUCCESS,
     NOTMUCH_PRIVATE_STATUS_OUT_OF_MEMORY		= NOTMUCH_STATUS_OUT_OF_MEMORY,
@@ -173,7 +173,7 @@ typedef enum _notmuch_private_status {
      (notmuch_status_t) private_status)
 
 /* Flags shared by various lookup functions. */
-typedef enum _notmuch_find_flags {
+typedef enum {
     /* Lookup without creating any documents.  This is the default
      * behavior. */
     NOTMUCH_FIND_LOOKUP = 0,
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 546643e80cbb..ca5878a949bc 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -112,7 +112,7 @@ typedef int notmuch_bool_t;
  * A zero value (NOTMUCH_STATUS_SUCCESS) indicates that the function
  * completed without error. Any other value indicates an error.
  */
-typedef enum _notmuch_status {
+typedef enum {
     /**
      * No error occurred.
      */
@@ -1678,7 +1678,7 @@ notmuch_message_reindex (notmuch_message_t *message,
 /**
  * Message flags.
  */
-typedef enum _notmuch_message_flag {
+typedef enum {
     NOTMUCH_MESSAGE_FLAG_MATCH,
     NOTMUCH_MESSAGE_FLAG_EXCLUDED,
 
@@ -2524,7 +2524,7 @@ notmuch_config_list_destroy (notmuch_config_list_t *config_list);
 /**
  * Configuration keys known to libnotmuch
  */
-typedef enum _notmuch_config_key {
+typedef enum {
     NOTMUCH_CONFIG_FIRST,
     NOTMUCH_CONFIG_DATABASE_PATH = NOTMUCH_CONFIG_FIRST,
     NOTMUCH_CONFIG_MAIL_ROOT,
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] cli: remove enum names from typedefs
  2021-10-13 14:02 [PATCH 1/2] lib: remove enum names from typedefs Jani Nikula
@ 2021-10-13 14:02 ` Jani Nikula
  2021-10-23 11:42 ` [PATCH 1/2] lib: " David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Jani Nikula @ 2021-10-13 14:02 UTC (permalink / raw)
  To: notmuch; +Cc: jani

There are some enum typedefs with the enum name:

    typedef enum _name_t { ... } name_t;

We don't need or use the enum names _name_t for anything, and not all
of the enum typedefs have them. We have the typedefs specifically to
use the typedef name.

Use the anonymous enum in the typedefs:

    typedef enum { ... } name_t;
---
 notmuch-client.h  | 4 ++--
 util/hex-escape.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 96d81166d2f5..82ae44e429fc 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -426,13 +426,13 @@ mime_node_seek_dfs (mime_node_t *node, int n);
 const _notmuch_message_crypto_t *
 mime_node_get_message_crypto_status (mime_node_t *node);
 
-typedef enum dump_formats {
+typedef enum {
     DUMP_FORMAT_AUTO,
     DUMP_FORMAT_BATCH_TAG,
     DUMP_FORMAT_SUP
 } dump_format_t;
 
-typedef enum dump_includes {
+typedef enum {
     DUMP_INCLUDE_TAGS		= 1,
     DUMP_INCLUDE_CONFIG		= 2,
     DUMP_INCLUDE_PROPERTIES	= 4
diff --git a/util/hex-escape.h b/util/hex-escape.h
index 8703334cda8d..83a4c6f146fe 100644
--- a/util/hex-escape.h
+++ b/util/hex-escape.h
@@ -5,7 +5,7 @@
 extern "C" {
 #endif
 
-typedef enum hex_status {
+typedef enum {
     HEX_SUCCESS = 0,
     HEX_SYNTAX_ERROR,
     HEX_OUT_OF_MEMORY
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] lib: remove enum names from typedefs
  2021-10-13 14:02 [PATCH 1/2] lib: remove enum names from typedefs Jani Nikula
  2021-10-13 14:02 ` [PATCH 2/2] cli: " Jani Nikula
@ 2021-10-23 11:42 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2021-10-23 11:42 UTC (permalink / raw)
  To: Jani Nikula, notmuch; +Cc: jani

Jani Nikula <jani@nikula.org> writes:

> There are some enum typedefs with the enum name:
>
>     typedef enum _name_t { ... } name_t;
>
> We don't need or use the enum names _name_t for anything, and not all
> of the enum typedefs have them. We have the typedefs specifically to
> use the typedef name.

series applied to master

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-23 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 14:02 [PATCH 1/2] lib: remove enum names from typedefs Jani Nikula
2021-10-13 14:02 ` [PATCH 2/2] cli: " Jani Nikula
2021-10-23 11:42 ` [PATCH 1/2] lib: " David Bremner

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).