[glib/glib-2-32] OpenBSD: explicitely define nitems
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-32] OpenBSD: explicitely define nitems
- Date: Sat, 14 Jul 2012 23:23:35 +0000 (UTC)
commit 9e0ea405371c24cbcf0af4228e141bef4e8a2fbf
Author: Antoine Jacoutot <ajacoutot gnome org>
Date: Sun Jul 8 19:23:18 2012 +0200
OpenBSD: explicitely define nitems
nitems is never guaranteed to be defined in sys/params.h as it is meant
to be defined within a protected ifdef __KERNEL condition.
glib/goption.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/glib/goption.c b/glib/goption.c
index 3da6bfb..2fb42e1 100644
--- a/glib/goption.c
+++ b/glib/goption.c
@@ -1680,6 +1680,10 @@ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]