Include missing <stdlib.h> for calloc(3) and exit(3)

Leonardo Taccari <[email protected]> Mon, 12 Jan 2026 11:04:07 +0100
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <26779.1768212247.1@boh>

Hello!

When trying to build current HEAD of dillo in NetBSD the build fails
with:

 [...]
 g++ ... -o dialog.o dialog.cc
 [...]
 dialog.cc:38:1: note: 'calloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    37 | #include "dlib/dlib.h"
   +++ |+#include <cstdlib>
    38 |
 dialog.cc:192:11: error: 'exit' was not declared in this scope
   192 |           exit(1);
       |           ^~~~
 dialog.cc:192:11: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
 *** [dialog.o] Error code 1
 [...]

Including <stdlib.h> fixes that and the attached patch does that.


Thank you!

------- =_aaaaaaaaaa0
Content-Type: text/x-diff; charset="us-ascii";
	name="0001-calloc-3-and-exit-3-needs-stdlib.h.patch"
Content-Description: 0001-calloc-3-and-exit-3-needs-stdlib.h.patch
Content-Disposition: attachment;
	filename="0001-calloc-3-and-exit-3-needs-stdlib.h.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 29e96bb865a152ac56370d4ba618b3b4e1398ca4 Mon Sep 17 00:00:00 2001
From: Leonardo Taccari <[email protected]>
Date: Tue, 6 Jan 2026 18:14:30 +0100
Subject: [PATCH] calloc(3) and exit(3) needs <stdlib.h>

Noticed by building on NetBSD.
---
 src/dialog.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/dialog.cc b/src/dialog.cc
index e671b8ab..8254c1ed 100644
--- a/src/dialog.cc
+++ b/src/dialog.cc
@@ -14,6 +14,7 @@
  */
 =

 #include <math.h> // for rint()
+#include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 =

-- =

2.52.0


------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected]
To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected]

------- =_aaaaaaaaaa0--