global: drop incorrect memset

shell_global_get_memory_info tries to zero initialize the output
parameter with memset, but it passes the wrong size (because of
a missing *).  There's no reason to do the memset, though. In the
normal case all members of the struct gets initialized before the
function returns anyway.

This commit drops the memset call in favor of one explicit 0 assignment
that only gets executed on on atypical platforms.

https://bugzilla.gnome.org/show_bug.cgi?id=662236
This commit is contained in:
Ray Strode 2011-10-19 16:21:59 -04:00
parent c573e7f9a1
commit de352a309d

View File

@ -1182,12 +1182,13 @@ shell_global_get_memory_info (ShellGlobal *global,
JSContext *context; JSContext *context;
gint64 now; gint64 now;
memset (meminfo, 0, sizeof (meminfo));
#ifdef HAVE_MALLINFO #ifdef HAVE_MALLINFO
{ {
struct mallinfo info = mallinfo (); struct mallinfo info = mallinfo ();
meminfo->glibc_uordblks = info.uordblks; meminfo->glibc_uordblks = info.uordblks;
} }
#else
meminfo->glibc_uordblks = 0;
#endif #endif
context = gjs_context_get_native_context (global->js_context); context = gjs_context_get_native_context (global->js_context);