library: show allowable range in relative enum warning
This patch just trades the 'typestr' for the much more meaningful 'valid range' when a relative enum has been deemed invalid under that XTRA_PROCPS_DEBUG provision. [ and we'll also make one comment a bit more generic ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
c3070c636b
commit
a9ac3faa44
@ -948,7 +948,7 @@ PROCPS_EXPORT struct diskstats_stack **procps_diskstats_sort (
|
||||
*
|
||||
* It's used only when:
|
||||
* 1) the 'XTRA_PROCPS_DEBUG' has been defined, or
|
||||
* 2) the '#include <proc/xtra-procps-debug.h>' used
|
||||
* 2) an #include of 'xtra-procps-debug.h' is used
|
||||
*/
|
||||
|
||||
PROCPS_EXPORT struct diskstats_result *xtra_diskstats_get (
|
||||
@ -989,8 +989,8 @@ PROCPS_EXPORT struct diskstats_result *xtra_diskstats_val (
|
||||
for (i = 0; stack->head[i].item < DISKSTATS_logical_end; i++)
|
||||
;
|
||||
if (relative_enum < 0 || relative_enum >= i) {
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, type = %s\n"
|
||||
, file, lineno, relative_enum, typestr);
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, valid range = 0-%d\n"
|
||||
, file, lineno, relative_enum, i-1);
|
||||
return NULL;
|
||||
}
|
||||
str = Item_table[stack->head[relative_enum].item].type2str;
|
||||
|
@ -925,7 +925,7 @@ PROCPS_EXPORT struct meminfo_stack *procps_meminfo_select (
|
||||
*
|
||||
* It's used only when:
|
||||
* 1) the 'XTRA_PROCPS_DEBUG' has been defined, or
|
||||
* 2) the '#include <proc/xtra-procps-debug.h>' used
|
||||
* 2) an #include of 'xtra-procps-debug.h' is used
|
||||
*/
|
||||
|
||||
PROCPS_EXPORT struct meminfo_result *xtra_meminfo_get (
|
||||
@ -965,8 +965,8 @@ PROCPS_EXPORT struct meminfo_result *xtra_meminfo_val (
|
||||
for (i = 0; stack->head[i].item < MEMINFO_logical_end; i++)
|
||||
;
|
||||
if (relative_enum < 0 || relative_enum >= i) {
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, type = %s\n"
|
||||
, file, lineno, relative_enum, typestr);
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, valid range = 0-%d\n"
|
||||
, file, lineno, relative_enum, i-1);
|
||||
return NULL;
|
||||
}
|
||||
str = Item_table[stack->head[relative_enum].item].type2str;
|
||||
|
@ -1502,7 +1502,7 @@ PROCPS_EXPORT struct pids_stack **procps_pids_sort (
|
||||
*
|
||||
* It's used only when:
|
||||
* 1) the 'XTRA_PROCPS_DEBUG' has been defined, or
|
||||
* 2) the '#include <proc/xtra-procps-debug.h>' used
|
||||
* 2) an #include of 'xtra-procps-debug.h' is used
|
||||
*/
|
||||
|
||||
PROCPS_EXPORT struct pids_result *xtra_pids_val (
|
||||
@ -1519,8 +1519,8 @@ PROCPS_EXPORT struct pids_result *xtra_pids_val (
|
||||
for (i = 0; stack->head[i].item < PIDS_logical_end; i++)
|
||||
;
|
||||
if (relative_enum < 0 || relative_enum >= i) {
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, type = %s\n"
|
||||
, file, lineno, relative_enum, typestr);
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, valid range = 0-%d\n"
|
||||
, file, lineno, relative_enum, i-1);
|
||||
return NULL;
|
||||
}
|
||||
str = Item_table[stack->head[relative_enum].item].type2str;
|
||||
|
@ -965,7 +965,7 @@ PROCPS_EXPORT struct slabinfo_stack **procps_slabinfo_sort (
|
||||
*
|
||||
* It's used only when:
|
||||
* 1) the 'XTRA_PROCPS_DEBUG' has been defined, or
|
||||
* 2) the '#include <proc/xtra-procps-debug.h>' used
|
||||
* 2) an #include of 'xtra-procps-debug.h' is used
|
||||
*/
|
||||
|
||||
PROCPS_EXPORT struct slabinfo_result *xtra_slabinfo_get (
|
||||
@ -1005,8 +1005,8 @@ PROCPS_EXPORT struct slabinfo_result *xtra_slabinfo_val (
|
||||
for (i = 0; stack->head[i].item < SLABINFO_logical_end; i++)
|
||||
;
|
||||
if (relative_enum < 0 || relative_enum >= i) {
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, type = %s\n"
|
||||
, file, lineno, relative_enum, typestr);
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, valid range = 0-%d\n"
|
||||
, file, lineno, relative_enum, i-1);
|
||||
return NULL;
|
||||
}
|
||||
str = Item_table[stack->head[relative_enum].item].type2str;
|
||||
|
@ -1152,7 +1152,7 @@ PROCPS_EXPORT struct stat_stack **procps_stat_sort (
|
||||
*
|
||||
* It's used only when:
|
||||
* 1) the 'XTRA_PROCPS_DEBUG' has been defined, or
|
||||
* 2) the '#include <proc/xtra-procps-debug.h>' used
|
||||
* 2) an #include of 'xtra-procps-debug.h' is used
|
||||
*/
|
||||
|
||||
PROCPS_EXPORT struct stat_result *xtra_stat_get (
|
||||
@ -1192,8 +1192,8 @@ PROCPS_EXPORT struct stat_result *xtra_stat_val (
|
||||
for (i = 0; stack->head[i].item < STAT_logical_end; i++)
|
||||
;
|
||||
if (relative_enum < 0 || relative_enum >= i) {
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, type = %s\n"
|
||||
, file, lineno, relative_enum, typestr);
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, valid range = 0-%d\n"
|
||||
, file, lineno, relative_enum, i-1);
|
||||
return NULL;
|
||||
}
|
||||
str = Item_table[stack->head[relative_enum].item].type2str;
|
||||
|
@ -1355,7 +1355,7 @@ PROCPS_EXPORT struct vmstat_stack *procps_vmstat_select (
|
||||
*
|
||||
* It's used only when:
|
||||
* 1) the 'XTRA_PROCPS_DEBUG' has been defined, or
|
||||
* 2) the '#include <proc/xtra-procps-debug.h>' used
|
||||
* 2) an #include of 'xtra-procps-debug.h' is used
|
||||
*/
|
||||
|
||||
PROCPS_EXPORT struct vmstat_result *xtra_vmstat_get (
|
||||
@ -1395,8 +1395,8 @@ PROCPS_EXPORT struct vmstat_result *xtra_vmstat_val (
|
||||
for (i = 0; stack->head[i].item < VMSTAT_logical_end; i++)
|
||||
;
|
||||
if (relative_enum < 0 || relative_enum >= i) {
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, type = %s\n"
|
||||
, file, lineno, relative_enum, typestr);
|
||||
fprintf(stderr, "%s line %d: invalid relative_enum = %d, valid range = 0-%d\n"
|
||||
, file, lineno, relative_enum, i-1);
|
||||
return NULL;
|
||||
}
|
||||
str = Item_table[stack->head[relative_enum].item].type2str;
|
||||
|
Loading…
Reference in New Issue
Block a user