library: some minor miscellaeous improvements, 3rd gen

A collection of miscellaneous code and comment tweaks.

[ such changes will stop when desk checking ends too ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-07-13 00:00:00 -05:00 committed by Craig Small
parent c767adf974
commit 220236a9af
5 changed files with 24 additions and 19 deletions

View File

@ -574,6 +574,7 @@ static int read_meminfo_failed (
buf[size] = '\0';
head = buf;
for (;;) {
static ENTRY e; // just to keep coverity off our backs (e.data)
ENTRY *ep;
@ -595,7 +596,6 @@ static int read_meminfo_failed (
tail = strchr(head, '\n');
if (!tail)
break;
head = tail + 1;
}
@ -628,10 +628,10 @@ static int read_meminfo_failed (
mHr(derived_swap_used) = mHr(SwapTotal) - mHr(SwapFree);
// let's not distort the deltas the first time thru ...
if (!info->meminfo_was_read)
if (!info->meminfo_was_read) {
memcpy(&info->hist.old, &info->hist.new, sizeof(struct meminfo_data));
info->meminfo_was_read = 1;
info->meminfo_was_read = 1;
}
return 0;
#undef mHr
} // end: read_meminfo_failed
@ -710,7 +710,8 @@ static struct stacks_extent *stacks_alloc (
* The initial refcount is 1, and needs to be decremented
* to release the resources of the structure.
*
* Returns: a pointer to a new meminfo struct
* Returns: < 0 on failure, 0 on success along with
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_meminfo_new (
struct procps_meminfo **info)

View File

@ -1117,7 +1117,8 @@ static int stacks_fetch (
*
* @info: location of returned new structure
*
* Returns: 0 on success <0 on failure
* Returns: < 0 on failure, 0 on success along with
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_pids_new (
struct procps_pidsinfo **info,

View File

@ -491,10 +491,10 @@ static int read_slabinfo_failed (
else
return -ERANGE;
if (!info->slabinfo_was_read)
if (!info->slabinfo_was_read) {
memcpy(&info->hist.old, &info->hist.new, sizeof(struct slabs_summ));
info->slabinfo_was_read = 1;
info->slabinfo_was_read = 1;
}
return retval;
} // end: read_slabinfo_failed
@ -773,7 +773,8 @@ static int stacks_reconfig_maybe (
*
* @info: location of returned new structure
*
* Returns: 0 on success <0 on failure
* Returns: < 0 on failure, 0 on success along with
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_slabinfo_new (
struct procps_slabinfo **info)

View File

@ -577,10 +577,10 @@ reap_em_again:
info->sys_hist.new.procs_running = llnum;
// let's not distort the deltas the first time thru ...
if (!info->stat_was_read)
if (!info->stat_was_read) {
memcpy(&info->sys_hist.old, &info->sys_hist.new, sizeof(struct stat_data));
info->stat_was_read = 1;
info->stat_was_read = 1;
}
return 0;
} // end: read_stat_failed
@ -769,7 +769,8 @@ static struct stat_stack *update_single_stack (
* The initial refcount is 1, and needs to be decremented
* to release the resources of the structure.
*
* Returns: a new stat info container
* Returns: < 0 on failure, 0 on success along with
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_stat_new (
struct procps_statinfo **info)

View File

@ -999,6 +999,7 @@ static int read_vmstat_failed (
buf[size] = '\0';
head = buf;
for (;;) {
static ENTRY e; // just to keep coverity off our backs (e.data)
ENTRY *ep;
@ -1020,15 +1021,14 @@ static int read_vmstat_failed (
tail = strchr(head, '\n');
if (!tail)
break;
head = tail + 1;
}
// let's not distort the deltas the first time thru ...
if (!info->vmstat_was_read)
if (!info->vmstat_was_read) {
memcpy(&info->hist.old, &info->hist.new, sizeof(struct vmstat_data));
info->vmstat_was_read = 1;
info->vmstat_was_read = 1;
}
return 0;
} // end: read_vmstat_failed
@ -1106,7 +1106,8 @@ static struct stacks_extent *stacks_alloc (
* The initial refcount is 1, and needs to be decremented
* to release the resources of the structure.
*
* Returns: a pointer to a new vmstatinfo struct
* Returns: < 0 on failure, 0 on success along with
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_vmstat_new (
struct procps_vmstat **info)