diff options
author | Antoine Jacoutot <ajacoutot@gnome.org> | 2012-07-09 18:20:34 +0200 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@gnome.org> | 2012-07-09 18:20:34 +0200 |
commit | 974212ec825d8d50bdea8ab955b6f19b8ed1672f (patch) | |
tree | c74e84a2666a5d88939506332e804989aa983c85 /gtk | |
parent | b900016a05b9bdb3736fe79ce8413b6e5ba2efa3 (diff) | |
download | gtk+-974212ec825d8d50bdea8ab955b6f19b8ed1672f.tar.gz |
OpenBSD: use G_N_ELEMENTS instead of nitems
nitems is never guaranteed to be defined in sys/params.h as it is meant
to be defined within a protected ifdef __KERNEL conditional.
Use G_N_ELEMENTS from GLib which is the proper way of doing this.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkmountoperation-x11.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gtk/gtkmountoperation-x11.c b/gtk/gtkmountoperation-x11.c index cc521ce999..fe8beb6949 100644 --- a/gtk/gtkmountoperation-x11.c +++ b/gtk/gtkmountoperation-x11.c @@ -731,11 +731,11 @@ pid_get_parent (GPid pid) int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), 0 }; - if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) == -1) + if (sysctl(mib, G_N_ELEMENTS (mib), NULL, &len, NULL, 0) == -1) return (-1); mib[5] = (len / sizeof(struct kinfo_proc)); - if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) < 0) + if (sysctl(mib, G_N_ELEMENTS (mib), &kp, &len, NULL, 0) < 0) return -1; ppid = kp.p_ppid; @@ -760,7 +760,7 @@ pid_get_env (GPid pid, const gchar *key) key_len = strlen (key); ret = NULL; - if (sysctl(mib, nitems(mib), strs, &len, NULL, 0) != -1) + if (sysctl(mib, G_N_ELEMENTS (mib), strs, &len, NULL, 0) != -1) { for (i = 0; strs[i] != NULL; i++) { @@ -792,7 +792,7 @@ pid_get_command_line (GPid pid) strs = (char **)realloc(strs, len); - if (sysctl(mib, nitems(mib), strs, &len, NULL, 0) == -1) { + if (sysctl(mib, G_N_ELEMENTS (mib), strs, &len, NULL, 0) == -1) { g_free (strs); return ret; } |