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:
@@ -224,6 +224,10 @@ MEM_set(SWAP_FREE, ul_int, SwapFree)
|
||||
MEM_set(SWAP_TOTAL, ul_int, SwapTotal)
|
||||
MEM_set(SWAP_USED, ul_int, derived_swap_used)
|
||||
|
||||
#undef setDECL
|
||||
#undef MEM_set
|
||||
#undef HST_set
|
||||
|
||||
|
||||
// ___ Results 'Get' Support ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
@@ -332,6 +336,10 @@ MEM_get(SWAP_FREE, SwapFree)
|
||||
MEM_get(SWAP_TOTAL, SwapTotal)
|
||||
MEM_get(SWAP_USED, derived_swap_used)
|
||||
|
||||
#undef getDECL
|
||||
#undef MEM_get
|
||||
#undef HST_get
|
||||
|
||||
|
||||
// ___ Controlling Table ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
@@ -456,16 +464,11 @@ static struct {
|
||||
enum meminfo_item PROCPS_MEMINFO_logical_end = PROCPS_MEMINFO_SWAP_USED + 1;
|
||||
|
||||
#undef setNAME
|
||||
#undef setDECL
|
||||
#undef MEM_set
|
||||
#undef HST_set
|
||||
#undef getNAME
|
||||
#undef getDECL
|
||||
#undef MEM_get
|
||||
#undef HST_get
|
||||
#undef RS
|
||||
#undef RG
|
||||
|
||||
|
||||
// ___ Private Functions ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
static inline void assign_results (
|
||||
@@ -816,6 +819,8 @@ static struct stacks_extent *stacks_alloc (
|
||||
|
||||
// ___ Public Functions |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
// --- standard required functions --------------------------------------------
|
||||
|
||||
/*
|
||||
* procps_meminfo_new:
|
||||
*
|
||||
@@ -882,6 +887,8 @@ PROCPS_EXPORT int procps_meminfo_unref (
|
||||
} // end: procps_meminfo_unref
|
||||
|
||||
|
||||
// --- variable interface functions -------------------------------------------
|
||||
|
||||
PROCPS_EXPORT signed long procps_meminfo_get (
|
||||
struct procps_meminfo *info,
|
||||
enum meminfo_item item)
|
||||
@@ -904,9 +911,7 @@ PROCPS_EXPORT signed long procps_meminfo_get (
|
||||
sav_secs = cur_secs;
|
||||
}
|
||||
|
||||
if (item < PROCPS_MEMINFO_logical_end)
|
||||
return Item_table[item].getsfunc(info);
|
||||
return -EINVAL;
|
||||
return Item_table[item].getsfunc(info);
|
||||
} // end: procps_meminfo_get
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user