1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-05 21:34:17 +01:00

Info Panel: mallinfo is deprecated use mallinfo2 instead

Replacing mallinfo with mallinfo2.

The fields of the mallinfo structure that is returned by the
older mallinfo() function are typed as int.  However, because
some internal bookkeeping values may be of type long, the
reported values may wrap around zero and thus be inaccurate.
This commit is contained in:
David Maciejak
2023-02-11 06:35:09 +08:00
committed by Carlos R. Mafra
parent e3ee459a78
commit 437b76812d
2 changed files with 6 additions and 5 deletions

View File

@@ -387,7 +387,7 @@ AC_FUNC_MEMCMP
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
WM_FUNC_SECURE_GETENV WM_FUNC_SECURE_GETENV
AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \ AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
setsid mallinfo mkstemp sysconf) setsid mallinfo2 mkstemp sysconf)
AC_SEARCH_LIBS([strerror], [cposix]) AC_SEARCH_LIBS([strerror], [cposix])
dnl nanosleep is generally available in standard libc, although not always the dnl nanosleep is generally available in standard libc, although not always the

View File

@@ -1320,14 +1320,15 @@ void wShowInfoPanel(WScreen *scr)
break; break;
} }
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2)
{ {
struct mallinfo ma = mallinfo(); struct mallinfo2 ma = mallinfo2();
snprintf(buffer, sizeof(buffer), snprintf(buffer, sizeof(buffer),
#ifdef DEBUG #ifdef DEBUG
_("Total memory allocated: %i kB (in use: %i kB, %d free chunks).\n"), _("Total memory allocated: %lu kB (in use: %lu kB, %lu free chunks).\n"),
#else #else
_("Total memory allocated: %i kB (in use: %i kB).\n"), _("Total memory allocated: %lu kB (in use: %lu kB).\n"),
#endif #endif
(ma.arena + ma.hblkhd) / 1024, (ma.arena + ma.hblkhd) / 1024,
(ma.uordblks + ma.hblkhd) / 1024 (ma.uordblks + ma.hblkhd) / 1024