From 4ba0f9ff4f1780386a4d556dfec0ac8e93c98f08 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sun, 29 Nov 2009 16:34:15 +0100 Subject: [PATCH] pid objects: convert to callbacks.print --- src/conky.c | 120 ---------------------------------------------------- src/core.c | 40 ++++++++++++++++++ 2 files changed, 40 insertions(+), 120 deletions(-) diff --git a/src/conky.c b/src/conky.c index 60ed2164..7ca446bd 100644 --- a/src/conky.c +++ b/src/conky.c @@ -795,126 +795,6 @@ void generate_text_internal(char *p, int p_max_size, need_to_load_fonts = 1; } #endif /* X11 */ - OBJ(pid_chroot) { - print_pid_chroot(obj, p, p_max_size); - } - OBJ(pid_cmdline) { - print_pid_cmdline(obj, p, p_max_size); - } - OBJ(pid_cwd) { - print_pid_cwd(obj, p, p_max_size); - } - OBJ(pid_environ) { - print_pid_environ(obj, p, p_max_size); - } - OBJ(pid_environ_list) { - print_pid_environ_list(obj, p, p_max_size); - } - OBJ(pid_exe) { - print_pid_exe(obj, p, p_max_size); - } - OBJ(pid_nice) { - print_pid_nice(obj, p, p_max_size); - } - OBJ(pid_openfiles) { - print_pid_openfiles(obj, p, p_max_size); - } - OBJ(pid_parent) { - print_pid_parent(obj, p, p_max_size); - } - OBJ(pid_priority) { - print_pid_priority(obj, p, p_max_size); - } - OBJ(pid_state) { - print_pid_state(obj, p, p_max_size); - } - OBJ(pid_state_short) { - print_pid_state_short(obj, p, p_max_size); - } - OBJ(pid_stderr) { - print_pid_stderr(obj, p, p_max_size); - } - OBJ(pid_stdin) { - print_pid_stdin(obj, p, p_max_size); - } - OBJ(pid_stdout) { - print_pid_stdout(obj, p, p_max_size); - } - OBJ(pid_threads) { - print_pid_threads(obj, p, p_max_size); - } - OBJ(pid_thread_list) { - print_pid_thread_list(obj, p, p_max_size); - } - OBJ(pid_time_kernelmode) { - print_pid_time_kernelmode(obj, p, p_max_size); - } - OBJ(pid_time_usermode) { - print_pid_time_usermode(obj, p, p_max_size); - } - OBJ(pid_time) { - print_pid_time(obj, p, p_max_size); - } - OBJ(pid_uid) { - print_pid_uid(obj, p, p_max_size); - } - OBJ(pid_euid) { - print_pid_euid(obj, p, p_max_size); - } - OBJ(pid_suid) { - print_pid_suid(obj, p, p_max_size); - } - OBJ(pid_fsuid) { - print_pid_fsuid(obj, p, p_max_size); - } - OBJ(pid_gid) { - print_pid_gid(obj, p, p_max_size); - } - OBJ(pid_egid) { - print_pid_egid(obj, p, p_max_size); - } - OBJ(pid_sgid) { - print_pid_sgid(obj, p, p_max_size); - } - OBJ(pid_fsgid) { - print_pid_fsgid(obj, p, p_max_size); - } - OBJ(pid_read) { - print_pid_read(obj, p, p_max_size); - } - OBJ(pid_vmpeak) { - print_pid_vmpeak(obj, p, p_max_size); - } - OBJ(pid_vmsize) { - print_pid_vmsize(obj, p, p_max_size); - } - OBJ(pid_vmlck) { - print_pid_vmlck(obj, p, p_max_size); - } - OBJ(pid_vmhwm) { - print_pid_vmhwm(obj, p, p_max_size); - } - OBJ(pid_vmrss) { - print_pid_vmrss(obj, p, p_max_size); - } - OBJ(pid_vmdata) { - print_pid_vmdata(obj, p, p_max_size); - } - OBJ(pid_vmstk) { - print_pid_vmstk(obj, p, p_max_size); - } - OBJ(pid_vmexe) { - print_pid_vmexe(obj, p, p_max_size); - } - OBJ(pid_vmlib) { - print_pid_vmlib(obj, p, p_max_size); - } - OBJ(pid_vmpte) { - print_pid_vmpte(obj, p, p_max_size); - } - OBJ(pid_write) { - print_pid_write(obj, p, p_max_size); - } OBJ(text) { snprintf(p, p_max_size, "%s", obj->data.s); } diff --git a/src/core.c b/src/core.c index bccf6361..3b531bac 100644 --- a/src/core.c +++ b/src/core.c @@ -860,88 +860,128 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.print = &print_cmdline_to_pid; END OBJ_ARG(pid_chroot, 0, "pid_chroot needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_chroot; END OBJ_ARG(pid_cmdline, 0, "pid_cmdline needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_cmdline; END OBJ_ARG(pid_cwd, 0, "pid_cwd needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_cwd; END OBJ_ARG(pid_environ, 0, "pid_environ needs arguments") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_environ; END OBJ_ARG(pid_environ_list, 0, "pid_environ_list needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_environ_list; END OBJ_ARG(pid_exe, 0, "pid_exe needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_exe; END OBJ_ARG(pid_nice, 0, "pid_nice needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_nice; END OBJ_ARG(pid_openfiles, 0, "pid_openfiles needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_openfiles; END OBJ_ARG(pid_parent, 0, "pid_parent needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_parent; END OBJ_ARG(pid_priority, 0, "pid_priority needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_priority; END OBJ_ARG(pid_state, 0, "pid_state needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_state; END OBJ_ARG(pid_state_short, 0, "pid_state_short needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_state_short; END OBJ_ARG(pid_stderr, 0, "pid_stderr needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_stderr; END OBJ_ARG(pid_stdin, 0, "pid_stdin needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_stdin; END OBJ_ARG(pid_stdout, 0, "pid_stdout needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_stdout; END OBJ_ARG(pid_threads, 0, "pid_threads needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_threads; END OBJ_ARG(pid_thread_list, 0, "pid_thread_list needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_thread_list; END OBJ_ARG(pid_time_kernelmode, 0, "pid_time_kernelmode needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_time_kernelmode; END OBJ_ARG(pid_time_usermode, 0, "pid_time_usermode needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_time_usermode; END OBJ_ARG(pid_time, 0, "pid_time needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_time; END OBJ_ARG(pid_uid, 0, "pid_uid needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_uid; END OBJ_ARG(pid_euid, 0, "pid_euid needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_euid; END OBJ_ARG(pid_suid, 0, "pid_suid needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_suid; END OBJ_ARG(pid_fsuid, 0, "pid_fsuid needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_fsuid; END OBJ_ARG(pid_gid, 0, "pid_gid needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_gid; END OBJ_ARG(pid_egid, 0, "pid_egid needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_egid; END OBJ_ARG(pid_sgid, 0, "pid_sgid needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_sgid; END OBJ_ARG(pid_fsgid, 0, "pid_fsgid needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_fsgid; END OBJ_ARG(gid_name, 0, "gid_name needs a gid as argument") extract_object_args_to_sub(obj, arg); END OBJ_ARG(uid_name, 0, "uid_name needs a uid as argument") extract_object_args_to_sub(obj, arg); END OBJ_ARG(pid_read, 0, "pid_read needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_read; END OBJ_ARG(pid_vmpeak, 0, "pid_vmpeak needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmpeak; END OBJ_ARG(pid_vmsize, 0, "pid_vmsize needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmsize; END OBJ_ARG(pid_vmlck, 0, "pid_vmlck needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmlck; END OBJ_ARG(pid_vmhwm, 0, "pid_vmhwm needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmhwm; END OBJ_ARG(pid_vmrss, 0, "pid_vmrss needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmrss; END OBJ_ARG(pid_vmdata, 0, "pid_vmdata needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmdata; END OBJ_ARG(pid_vmstk, 0, "pid_vmstk needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmstk; END OBJ_ARG(pid_vmexe, 0, "pid_vmexe needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmexe; END OBJ_ARG(pid_vmlib, 0, "pid_vmlib needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmlib; END OBJ_ARG(pid_vmpte, 0, "pid_vmpte needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_vmpte; END OBJ_ARG(pid_write, 0, "pid_write needs a pid as argument") extract_object_args_to_sub(obj, arg); + obj->callbacks.print = &print_pid_write; END OBJ(processes, &update_total_processes) obj->callbacks.print = &print_processes; #ifdef __linux__