library: more tweaks for code and/or comments, 3rd gen

Following is a summary of significant changes (if any)
to each of these now upgraded 3rd gen library modules.

<meminfo> ............................................
. eliminated duplicate decl of 'struct procps_meminfo'
. standardized/normalized results struct union members
. added 'std' & 'var' dividers in .c file, like <pids>
. how did i miss relocating all these friggin' #undefs
. cleanup 'get' return logic (remove a redundant 'if')

<pids> ...............................................
. repositioned the procps_pidsinfo structure in header
. removed the extra trailing comma from enum pids_item
. standardized/normalized results struct union members

<slabinfo> ...........................................
. corrected comment typo (jeeze, in an 'aligned' para)
. standardized/normalized results struct union members
. added 'std' & 'var' dividers in .c file, like <pids>
. removed an obsolete #undef from procps_slabinfo_sort
. cleanup 'get' return logic (remove a redundant 'if')

<stat> ...............................................
. how did i miss relocating all these friggin' #undefs
. corrected an initialization fencepost used with numa <=== see Craig, here's a bug fix
. removed the extra trailing comma from enum stat_item
. standardized/normalized results struct union members
. added 'std' & 'var' dividers in .c file, like <pids>
. strengthen those parm checks in procps_stat_get func
. cleanup 'get' return logic (remove a redundant 'if')

<vmstat> .............................................
. standardized/normalized results struct union members
. added 'std' & 'var' dividers in .c file, like <pids>
. cleanup 'get' return logic (remove a redundant 'if')

[ virtually all of these tweaks reflect the author's ]
[ continuing pursuit of an unreasonable goal -- that ]
[ of a 'perfect' (plus 'pretty') C language program! ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-06-14 00:00:00 -05:00
committed by Craig Small
parent 61647f1b95
commit 4a0e974b7f
9 changed files with 70 additions and 51 deletions

View File

@ -144,7 +144,7 @@ enum pids_item {
PROCPS_PIDS_VM_USED, // sl_int
PROCPS_PIDS_VSIZE_PGS, // ul_int
PROCPS_PIDS_WCHAN_ADDR, // ul_int
PROCPS_PIDS_WCHAN_NAME, // str
PROCPS_PIDS_WCHAN_NAME // str
};
enum pids_fetch_type {
@ -163,19 +163,17 @@ enum pids_sort_order {
};
struct procps_pidsinfo;
struct pids_result {
enum pids_item item;
union {
char s_ch;
int s_int;
unsigned int u_int;
long sl_int;
unsigned long ul_int;
unsigned long long ull_int;
char * str;
char ** strv;
signed char s_ch;
signed int s_int;
unsigned int u_int;
signed long sl_int;
unsigned long ul_int;
unsigned long long ull_int;
char *str;
char **strv;
} result;
};
@ -198,6 +196,8 @@ struct pids_fetch {
stack -> head [ rel_enum ] . result . type
struct procps_pidsinfo;
int procps_pids_new (struct procps_pidsinfo **info, enum pids_item *items, int numitems);
int procps_pids_ref (struct procps_pidsinfo *info);
int procps_pids_unref (struct procps_pidsinfo **info);