Commit 9d8af19a0a58d41ba1be379276858dc8d0712d4f

Thomas de Grivel 2025-01-06T10:04:15

fix compilation on OpenBSD

diff --git a/kc3_smtp.c b/kc3_smtp.c
index 83cd84c..95a1846 100644
--- a/kc3_smtp.c
+++ b/kc3_smtp.c
@@ -10,20 +10,23 @@
  * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
  * THIS SOFTWARE.
  */
+#include <libkc3/kc3.h>
 #include "kc3_smtp.h"
+#include "smtp.h"
 
 sw kc3_smtp_close (u_ptr_w *smtp)
 {
-  smtp_close(smtp->p);
+  return smtp_close(smtp->p);
 }
 
-u_ptr * kc3_smtp_open (const s_str *server, const s_str *port,
-                       const s_sym * const *security,
-                       const s_sym * const *flags,
-                       const s_str *cafile, u_ptr *dest)
+u_ptr_w * kc3_smtp_open (const s_str *server, const s_str *port,
+                         const s_sym * const *security,
+                         const s_sym * const *flags,
+                         const s_str *cafile, u_ptr_w *dest)
 {
   const char *ca = NULL;
   enum smtp_flag f = 0;
+  sw r;
   enum smtp_connection_security sec = 0;
   u_ptr_w tmp;
   if (*security == sym_1("none"))
@@ -50,7 +53,8 @@ u_ptr * kc3_smtp_open (const s_str *server, const s_str *port,
   }
   if (cafile->size)
     ca = cafile->ptr.pchar;
-  r = smtp_open(server->ptr.pchar, port->ptr.pchar, sec, f, ca, &tmp);
+  r = smtp_open(server->ptr.pchar, port->ptr.pchar, sec, f, ca,
+                (struct smtp **) &tmp.p);
   switch (r) {
   case SMTP_STATUS_OK:
     *dest = tmp;
diff --git a/kc3_smtp.h b/kc3_smtp.h
index 21918c4..fddbf11 100644
--- a/kc3_smtp.h
+++ b/kc3_smtp.h
@@ -16,11 +16,11 @@
 #include "types.h"
 
 /* Heap-allocation functions, call kc3_smtp_close after use. */
-sw      kc3_smtp_close (u_ptr *smtp);
-u_ptr * kc3_smtp_open (const s_str *server, const s_str *port,
-                       const s_sym * const *security,
-                       const s_sym * const *flags,
-                       const s_str *cafile, u_ptr *dest);
+sw        kc3_smtp_close (u_ptr_w *smtp);
+u_ptr_w * kc3_smtp_open (const s_str *server, const s_str *port,
+                         const s_sym * const *security,
+                         const s_sym * const *flags,
+                         const s_str *cafile, u_ptr_w *dest);
 
 /* Operators. */