Switch back all bzero() calls to use memset()
Even if it's uglier to use memset, bzero seems deprecated.
This commit is contained in:
@@ -465,7 +465,7 @@ xtm_process_tree_model_row_changed (XtmProcessTreeModel *treemodel, GtkTreePath
|
||||
s_iter.user_data3 = NULL;
|
||||
|
||||
/* Use the root entry as fall-back if no parent could be found */
|
||||
bzero(&found, sizeof(found));
|
||||
memset(&found, 0, sizeof(found));
|
||||
found.parent = treemodel->tree;
|
||||
found.treemodel = treemodel;
|
||||
gtk_tree_model_get_value (model, iter, treemodel->p_column, &found.p_value);
|
||||
@@ -643,7 +643,7 @@ xtm_process_tree_model_row_inserted (XtmProcessTreeModel *treemodel, GtkTreePath
|
||||
g_sequence_foreach_range (g_sequence_iter_next (lnk->list), g_sequence_get_end_iter (treemodel->list),
|
||||
do_path, (gpointer)gtk_tree_path_next);
|
||||
|
||||
bzero(&found, sizeof(found));
|
||||
memset(&found, 0, sizeof(found));
|
||||
found.parent = treemodel->tree;
|
||||
found.treemodel = treemodel;
|
||||
gtk_tree_model_get_value (model, iter, treemodel->p_column, &found.p_value);
|
||||
|
||||
@@ -99,7 +99,7 @@ gboolean get_task_list (GArray *task_list)
|
||||
#else
|
||||
struct kinfo_proc2 p = kp[i];
|
||||
#endif
|
||||
bzero(&t, sizeof(t));
|
||||
memset(&t, 0, sizeof(t));
|
||||
t.pid = p.p_pid;
|
||||
t.ppid = p.p_ppid;
|
||||
t.uid = p.p_uid;
|
||||
@@ -114,11 +114,11 @@ gboolean get_task_list (GArray *task_list)
|
||||
size = 1024;
|
||||
if ((args = malloc(size)) == NULL)
|
||||
errx(1,"failed to allocate memory for argv structures at %zu", size);
|
||||
bzero(args, size);
|
||||
memset(args, 0, size);
|
||||
for (;; size *= 2) {
|
||||
if ((args = realloc(args, size)) == NULL)
|
||||
errx(1,"failed to allocate memory (size=%zu) for argv structures of pid %d", size, t.pid);
|
||||
bzero(args, size);
|
||||
memset(args, 0, size);
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_PROC_ARGS;
|
||||
mib[2] = t.pid;
|
||||
|
||||
@@ -135,7 +135,7 @@ get_task_details (struct kinfo_proc *kp, Task *task)
|
||||
size_t bufsz;
|
||||
int i, oid[4];
|
||||
|
||||
bzero(task, sizeof(Task));
|
||||
memset(task, 0, sizeof(Task));
|
||||
task->pid = kp->ki_pid;
|
||||
task->ppid = kp->ki_ppid;
|
||||
task->cpu_user = 100.0f * ((float)kp->ki_pctcpu / FSCALE);
|
||||
@@ -151,7 +151,7 @@ get_task_details (struct kinfo_proc *kp, Task *task)
|
||||
oid[2] = KERN_PROC_ARGS;
|
||||
oid[3] = kp->ki_pid;
|
||||
bufsz = sizeof(buf);
|
||||
bzero(buf, sizeof(buf));
|
||||
memset(buf, 0, sizeof(buf));
|
||||
if (sysctl(oid, 4, buf, &bufsz, 0, 0) == -1) {
|
||||
/*
|
||||
* If the supplied buf is too short to hold the requested
|
||||
|
||||
@@ -208,7 +208,7 @@ get_task_details (GPid pid, Task *task)
|
||||
}
|
||||
fclose (file);
|
||||
|
||||
bzero(task, sizeof(Task));
|
||||
memset(task, 0, sizeof(Task));
|
||||
|
||||
/* Scanning the short process name is unreliable with scanf when it contains
|
||||
* spaces, retrieve it manually and fill the buffer */
|
||||
|
||||
@@ -49,7 +49,7 @@ get_cpu_usage (gushort *cpu_count, gfloat *cpu_user, gfloat *cpu_system)
|
||||
static gboolean
|
||||
get_task_details (GPid pid, Task *task)
|
||||
{
|
||||
bzero(task, sizeof(Task));
|
||||
memset(task, 0, sizeof(Task));
|
||||
g_snprintf (task->name, sizeof(task->name), "foo");
|
||||
g_snprintf (task->cmdline, sizeof(task->cmdline), "foo -bar");
|
||||
g_snprintf (task->uid_name, sizeof(task->uid_name), "baz");
|
||||
|
||||
@@ -184,7 +184,7 @@ get_task_details (GPid pid, Task *task)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bzero(task, sizeof(Task));
|
||||
memset(task, 0, sizeof(Task));
|
||||
task->pid = process.pr_pid;
|
||||
task->ppid = process.pr_ppid;
|
||||
g_strlcpy (task->name, process.pr_fname, sizeof(task->name));
|
||||
|
||||
@@ -481,7 +481,7 @@ get_uid_name (guint uid)
|
||||
struct passwd *pw = NULL, pwd_buf;
|
||||
char buf[4096];
|
||||
|
||||
bzero(buf, sizeof(buf));
|
||||
memset(buf, 0, sizeof(buf));
|
||||
error = getpwuid_r(uid, &pwd_buf, buf, sizeof(buf), &pw);
|
||||
|
||||
return (g_strdup ((0 == error && pw != NULL) ? pw->pw_name : "nobody"));
|
||||
|
||||
Reference in New Issue
Block a user