Use G_N_ELEMENTS instead of nitems.

This commit is contained in:
ajacoutot 2012-07-09 16:34:21 +00:00
parent b12b28e564
commit 373e14caa0
2 changed files with 10 additions and 14 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.175 2012/07/06 16:25:05 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.176 2012/07/09 16:34:21 ajacoutot Exp $
COMMENT-main= general-purpose utility library
COMMENT-docs= glib2 documentation
@ -10,7 +10,7 @@ EXTRACT_SUFX= .tar.xz
PKGNAME-main= glib2-${VERSION}
PKGNAME-docs= glib2-docs-${VERSION}
REVISION-main= 0
REVISION-main= 1
CATEGORIES= devel

View File

@ -1,19 +1,15 @@
$OpenBSD: patch-glib_goption_c,v 1.5 2012/07/08 21:02:45 ajacoutot Exp $
$OpenBSD: patch-glib_goption_c,v 1.6 2012/07/09 16:34:21 ajacoutot Exp $
From f9a6a97470583417a26619b5da3d56097a15c6dd Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@gnome.org>
Date: Sun, 08 Jul 2012 17:23:18 +0000
Subject: OpenBSD: explicitely define nitems
https://bugzilla.gnome.org/show_bug.cgi?id=679590
--- 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)
--- glib/goption.c.orig Mon May 14 23:58:01 2012
+++ glib/goption.c Mon Jul 9 17:46:09 2012
@@ -1680,7 +1680,7 @@ 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)
- if (sysctl (mib, nitems (mib), cmdline, &len, NULL, 0) == -1)
+ if (sysctl (mib, G_N_ELEMENTS (mib), cmdline, &len, NULL, 0) == -1)
{
g_free (cmdline);
return NULL;