X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fprocesses.c;h=d2c0f44c0717a2cbee6df9149b142c6b3f24f006;hb=1ebf2f31;hp=8e2443bca4414be83166f06da96771a500560d9f;hpb=6a1a62048b6d0d2ddf5c17295609d3ebf010f40b;p=collectd.git diff --git a/src/processes.c b/src/processes.c index 8e2443bc..d2c0f44c 100644 --- a/src/processes.c +++ b/src/processes.c @@ -262,7 +262,7 @@ static void ps_list_register (const char *name, const char *regexp) procstat_t *ptr; int status; - new = (procstat_t *) malloc (sizeof (procstat_t)); + new = malloc (sizeof (*new)); if (new == NULL) { ERROR ("processes plugin: ps_list_register: malloc failed."); @@ -275,7 +275,7 @@ static void ps_list_register (const char *name, const char *regexp) if (regexp != NULL) { DEBUG ("ProcessMatch: adding \"%s\" as criteria to process %s.", regexp, name); - new->re = (regex_t *) malloc (sizeof (regex_t)); + new->re = malloc (sizeof (*new->re)); if (new->re == NULL) { ERROR ("processes plugin: ps_list_register: malloc failed."); @@ -410,7 +410,7 @@ static void ps_list_add (const char *name, const char *cmdline, procstat_entry_t { procstat_entry_t *new; - new = (procstat_entry_t *) malloc (sizeof (procstat_entry_t)); + new = malloc (sizeof (*new)); if (new == NULL) return; memset (new, 0, sizeof (procstat_entry_t)); @@ -1255,7 +1255,7 @@ static char *ps_get_cmdline (long pid, char *name, char *buf, size_t buf_len) return buf; } /* char *ps_get_cmdline (...) */ -static int read_fork_rate () +static int read_fork_rate (void) { FILE *proc_stat; char buffer[1024]; @@ -1450,7 +1450,7 @@ static int ps_read_process(long pid, procstat_t *ps, char *state) * are retrieved from kstat (module cpu, name sys, class misc, stat nthreads). * The result is the sum for all the threads created on each cpu */ -static int read_fork_rate() +static int read_fork_rate (void) { extern kstat_ctl_t *kc; kstat_t *ksp_chain = NULL;