git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] imap-send: drop unused fields from imap_cmd_cb

From
Jeff King <peff@peff.net>
Date
Jul 3, 2023, 06:34 UTC
Message-ID
<20230703063428.GC3524421@coredump.intra.peff.net>
In-Reply-To
<20230703063247.GA3524302@coredump.intra.peff.net>

The imap_cmd_cb struct has several fields which are totally unused. Presumably they did useful things in the upstream isync code from which this is derived, but they don't in our more limited program. This is particularly confusing for the "done" callback, which (as of the previous patch) no longer matches the signature of the adjacent "cont" callback.

Since we're unlikely to share code with isync going forward, we should feel free to simplify the code here. Note that "done" is examined but never set, so we can also drop a little bit of code outside of the struct definition.

Signed-off-by: Jeff King <peff@peff.net>
---
 imap-send.c | 4 ----
 1 file changed, 4 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index 81a87f434b..c1952d99e8 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -138,11 +138,9 @@ struct imap_store {
 
 struct imap_cmd_cb {
 	int (*cont)(struct imap_store *ctx, const char *prompt);
-	void (*done)(struct imap_store *ctx, struct imap_cmd *cmd, int response);
 	void *ctx;
 	char *data;
 	int dlen;
-	int uid;
 };
 
 struct imap_cmd {
@@ -828,8 +826,6 @@ static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
 			}
 			if ((resp2 = parse_response_code(ctx, &cmdp->cb, cmd)) > resp)
 				resp = resp2;
-			if (cmdp->cb.done)
-				cmdp->cb.done(ctx, cmdp, resp);
 			free(cmdp->cb.data);
 			free(cmdp->cmd);
 			free(cmdp);
-- 
2.41.0.586.g3c0cc15bc7
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “imap-send: some -Wunused-parameter cleanups”
  1. 0/3 imap-send: some -Wunused-parameter cleanupsJeff King, Jul 3, 2023
  2. 1/3 imap-send: use server conf argument in setup_curl()Jeff King, Jul 3, 2023
  3. Junio C HamanoJul 5, 2023
  4. 2/3 imap-send: drop unused parameter from imap_cmd_cb callbackJeff King, Jul 3, 2023
  5. Junio C HamanoJul 5, 2023
  6. 3/3 imap-send: drop unused fields from imap_cmd_cbJeff King, Jul 3, 2023
  7. Junio C HamanoJul 5, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.