don't rely on param.h for nitems(), ok ajacoutot@

This commit is contained in:
sthen 2012-07-08 17:09:17 +00:00
parent f5e3aee4f3
commit ddc61472cb
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-glib_goption_c,v 1.3 2012/07/08 17:09:18 sthen Exp $
--- glib/goption.c.orig Sun Jul 8 08:40:22 2012
+++ glib/goption.c Sun Jul 8 08:40:24 2012
@@ -1680,6 +1680,9 @@ platform_get_argv0 (void)
cmdline = (char **) realloc (cmdline, len);
+#ifndef nitems
+#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
+#endif
if (sysctl (mib, nitems (mib), cmdline, &len, NULL, 0) == -1)
{
g_free (cmdline);

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-gtk_gtkmountoperation-x11_c,v 1.7 2012/07/08 17:09:17 sthen Exp $
--- gtk/gtkmountoperation-x11.c.orig Sun Jul 8 09:40:51 2012
+++ gtk/gtkmountoperation-x11.c Sun Jul 8 09:42:51 2012
@@ -731,6 +731,9 @@ pid_get_parent (GPid pid)
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid,
sizeof(struct kinfo_proc), 0 };
+#ifndef nitems
+#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
+#endif
if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) == -1)
return (-1);
mib[5] = (len / sizeof(struct kinfo_proc));