author | Andrés J. Díaz <ajdiaz@connectical.com> | |
Thu, 17 Sep 2009 11:15:02 +0000 (13:15 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Thu, 17 Sep 2009 15:57:05 +0000 (17:57 +0200) | ||
commit | c327b3ae6b19713a56631e81886988121d3eef93 | |
tree | abdd6c4625a7ef20d766c85a62d4ab17e5c7c134 | tree | snapshot |
parent | 88998e1d5523cb2a949c09b75c3fcea93bea88ea | commit | diff |
processes plugin: Remove unnecessary call of realloc(3).
Hi Florian (et al)
> you're right, the (re-)allocation of the memory can probably be avoided
> if the function is turned into one with the following prototype:
> -- 8< --
> static int *ps_read_tasks (int pid,
> unsigned long *ret_num_proc,
> unsigned long *ret_num_lwp);
> -- >8 --
Mmm, why not something like: "static int ps_read_task(pid)"?
This returns the number of task for pid passed as argument.
(AFAIK the function only return the number ot threads), why
we need the ret_num_proc and the ret_num_lwp parameters?
My proposal is attached (code is always cleaner than explanations :P)
Regards,
Andres
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Hi Florian (et al)
> you're right, the (re-)allocation of the memory can probably be avoided
> if the function is turned into one with the following prototype:
> -- 8< --
> static int *ps_read_tasks (int pid,
> unsigned long *ret_num_proc,
> unsigned long *ret_num_lwp);
> -- >8 --
Mmm, why not something like: "static int ps_read_task(pid)"?
This returns the number of task for pid passed as argument.
(AFAIK the function only return the number ot threads), why
we need the ret_num_proc and the ret_num_lwp parameters?
My proposal is attached (code is always cleaner than explanations :P)
Regards,
Andres
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/processes.c | diff | blob | history |