Skip to contentSkip to conversation

imap-send: avoid curl functions when not building curl support

PATCH In review Jeff King 1 participant 2 messages Jun 15, 2016

lore
Share & tools
lore

Jeff King

author
#0 lore raw

PATCH 1/1 imap-send: avoid curl functions when not building curl support

Imap-send recently learned to conditionally compile against and use curl for imap support. To use this feature, you must both:

1. Compile with USE_CURL_FOR_IMAP_SEND

2. Specify --curl on the command line to enable it

It is OK (and even desirable) for the code checking --curl to be compiled even if USE_CURL_FOR_IMAP_SEND is not in effect; this lets us explain the situation to the user (instead of saying "--curl? never heard of it").

However, the code which conditionally runs when --curl is enabled must _not_ be compiled in this case. It references functions which are neither declared nor defined, causing the compiler to complain.

---
On top of br/imap-send-via-libcurl. I needed this to compile 'pu' with NO_CURL (which I don't usually do, but was testing on a minimal box). I expect it can just be squashed in to the next re-roll.

Since we were talking about testing in another thread, Junio, I wonder if it is worth having you compile your integration results against a couple different configs (e.g., NO_CURL). Obviously that will make things slower if you don't throw more CPU power at it, but that seems like a problem that can be solved with build servers or similar.

 imap-send.c | 2 ++
 1 file changed, 2 insertions(+)
imap-send.c +2 -0
index ad4ac22..e0e1f09 100644
@@ -1542,8 +1542,10 @@ int main(int argc, char **argv)
 	if (server.tunnel)
 		return append_msgs_to_imap(&server, &all_msgs, total);
 
+#ifdef USE_CURL_FOR_IMAP_SEND
 	if (use_curl)
 		return curl_append_msgs_to_imap(&server, &all_msgs, total);
+#endif
 
 	return append_msgs_to_imap(&server, &all_msgs, total);
 }
Signature · 1 line
2.1.2.596.g7379948
author
#1 lore raw
Quoted 3 lines · Jeff King

On top of br/imap-send-via-libcurl. I needed this to compile 'pu' with NO_CURL (which I don't usually do, but was testing on a minimal box). I expect it can just be squashed in to the next re-roll.

Oops, just started reading through my list backlog and realized you already noticed and dealt with this. Sorry for the noise.

-Peff