Removed useless tests. Replace g_malloc + memset by g_malloc0 Replace
* proclist.c: (glibtop_get_proclist_s): Removed useless tests. * procmap.c: (glibtop_get_proc_map_s): Replace g_malloc + memset by g_malloc0 * procstate.c: (glibtop_get_proc_state_s): Replace strncpy by g_strlcpy.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2004-06-06 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
|
* proclist.c: (glibtop_get_proclist_s): Removed useless tests.
|
||||||
|
* procmap.c: (glibtop_get_proc_map_s): Replace g_malloc + memset
|
||||||
|
by g_malloc0
|
||||||
|
* procstate.c: (glibtop_get_proc_state_s): Replace strncpy by g_strlcpy.
|
||||||
|
|
||||||
2004-05-25 Benoît Dejean <tazforever@dlfp.org>
|
2004-05-25 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
* loadavg.c: (glibtop_get_loadavg_s):
|
* loadavg.c: (glibtop_get_loadavg_s):
|
||||||
|
@@ -96,8 +96,7 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
|
|||||||
if(s_stat(buffer, &statb) < 0)
|
if(s_stat(buffer, &statb) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(!(pids_chain = g_malloc(sizeof(unsigned))))
|
pids_chain = g_malloc(sizeof(unsigned));
|
||||||
return NULL;
|
|
||||||
*pids_chain = pid;
|
*pids_chain = pid;
|
||||||
return pids_chain;
|
return pids_chain;
|
||||||
}
|
}
|
||||||
|
@@ -120,13 +120,10 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(!(entry = g_malloc(nmaps * sizeof(glibtop_map_entry))))
|
|
||||||
return NULL;
|
|
||||||
buf->number = nmaps;
|
buf->number = nmaps;
|
||||||
buf->size = sizeof(glibtop_map_entry);
|
buf->size = sizeof(glibtop_map_entry);
|
||||||
buf->total = nmaps * sizeof(glibtop_map_entry);
|
buf->total = nmaps * sizeof(glibtop_map_entry);
|
||||||
|
entry = g_malloc0(buf->total);
|
||||||
memset(entry, 0, nmaps * sizeof(glibtop_map_entry));
|
|
||||||
|
|
||||||
#if GLIBTOP_SOLARIS_RELEASE >= 560
|
#if GLIBTOP_SOLARIS_RELEASE >= 560
|
||||||
|
|
||||||
|
@@ -116,7 +116,7 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
|
|||||||
#if (LIBGTOP_VERSION_CODE >= 1001002) && defined(HAVE_PROCFS_H)
|
#if (LIBGTOP_VERSION_CODE >= 1001002) && defined(HAVE_PROCFS_H)
|
||||||
buf->last_processor = psinfo.pr_lwp.pr_onpro;
|
buf->last_processor = psinfo.pr_lwp.pr_onpro;
|
||||||
#endif
|
#endif
|
||||||
strncpy (buf->cmd, psinfo.pr_fname, 39);
|
g_strlcpy (buf->cmd, psinfo.pr_fname, sizeof buf->cmd);
|
||||||
|
|
||||||
buf->flags = _glibtop_sysdeps_proc_state;
|
buf->flags = _glibtop_sysdeps_proc_state;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user