summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-03-10 23:03:48 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-03-10 23:05:30 -0700
commite2f35443796d423ea5f96a99da425a927327deb2 (patch)
tree2ca4cce0736f937dcc60881686500bb4c752a034 /lib
parent89082c823c738b8e3b436e4af1307eefe193eac9 (diff)
downloademacs-e2f35443796d423ea5f96a99da425a927327deb2.tar.gz
Update from Gnulib
This incorporates: 2019-03-10 alloca-opt: Fix conflict mingw's new <alloca.h> file 2019-03-03 getloadavg: Write NULL for the null pointer Reported by Michal Privoznik <mprivozn@redhat.com>. * lib/getloadavg.c (getloadavg): Write NULL instead of 0. * build-aux/config.guess, build-aux/move-if-change: * doc/misc/texinfo.tex, lib/alloca.in.h, lib/getloadavg.c: * m4/alloca.m4: Copy from Gnulib. * lib/gnulib.mk.in: Regenerate.
Diffstat (limited to 'lib')
-rw-r--r--lib/alloca.in.h6
-rw-r--r--lib/getloadavg.c12
-rw-r--r--lib/gnulib.mk.in3
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index ec81e119a0f..a581d58f834 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -36,6 +36,12 @@
#ifndef alloca
# ifdef __GNUC__
+ /* Some version of mingw have an <alloca.h> that causes trouble when
+ included after 'alloca' gets defined as a macro. As a workaround, include
+ this <alloca.h> first and define 'alloca' as a macro afterwards. */
+# if (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@
+# include_next <alloca.h>
+# endif
# define alloca __builtin_alloca
# elif defined _AIX
# define alloca __alloca
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 353664777fb..08c14efcfce 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -424,17 +424,17 @@ getloadavg (double loadavg[], int nelem)
int saved_errno;
kc = kstat_open ();
- if (kc == 0)
+ if (kc == NULL)
return -1;
ksp = kstat_lookup (kc, "unix", 0, "system_misc");
- if (ksp == 0)
+ if (ksp == NULL)
return -1;
if (kstat_read (kc, ksp, 0) == -1)
return -1;
kn = kstat_data_lookup (ksp, "avenrun_1min");
- if (kn == 0)
+ if (kn == NULL)
{
/* Return -1 if no load average information is available. */
nelem = 0;
@@ -447,14 +447,14 @@ getloadavg (double loadavg[], int nelem)
if (nelem >= 2)
{
kn = kstat_data_lookup (ksp, "avenrun_5min");
- if (kn != 0)
+ if (kn != NULL)
{
loadavg[elem++] = (double) kn->value.ul / FSCALE;
if (nelem >= 3)
{
kn = kstat_data_lookup (ksp, "avenrun_15min");
- if (kn != 0)
+ if (kn != NULL)
loadavg[elem++] = (double) kn->value.ul / FSCALE;
}
}
@@ -895,7 +895,7 @@ getloadavg (double loadavg[], int nelem)
/* We pass 0 for the kernel, corefile, and swapfile names
to use the currently running kernel. */
kd = kvm_open (0, 0, 0, O_RDONLY, 0);
- if (kd != 0)
+ if (kd != NULL)
{
/* nlist the currently running kernel. */
kvm_nlist (kd, name_list);
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index d8e51ad403b..0d9a885be3d 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -479,6 +479,7 @@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
GTK_OBJ = @GTK_OBJ@
GZIP_PROG = @GZIP_PROG@
+HAVE_ALLOCA_H = @HAVE_ALLOCA_H@
HAVE_ALPHASORT = @HAVE_ALPHASORT@
HAVE_ATOLL = @HAVE_ATOLL@
HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@
@@ -1149,7 +1150,7 @@ ifneq (,$(GL_GENERATE_ALLOCA_H))
alloca.h: alloca.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/alloca.in.h; \
+ sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \
} > $@-t && \
mv -f $@-t $@
else