There's a huge toe-stubber awaiting future maintenance
as reflected in that commit below which deals with the
addition of new enumerators to the Item_table. Namely,
whenever the table is grown, one must remember to also
change that existing 'logical_end' enumerator's value.
Well, not anymore! Since that MAXTABLE macro was added
to the procps-private.h header we can now also exploit
it so a 'logical_end' automatically tracks table size.
This change also renders some code associated with the
ITEMTABLE_DEBUG #define unnecessary. So it's gone too.
Reference(s):
. 08/2016, add new enumerators
commit
09e1886c9e731f8b8c89a55d11f72f53f030b2de
. 08/2020, added MAXTABLE macro
commit
c865b06c304e645c05eae0f5e06a1f49ea105285
. 08/2020, introduced ITEMTABLE_DEBUG
commit
92d0297e1e4d5946c5b098e37c91c7e524a0eca0
Signed-off-by: Jim Warner <james.warner@comcast.net>
/* please note,
* this enum MUST be 1 greater than the highest value of any enum */
-enum diskstats_item DISKSTATS_logical_end = DISKSTATS_DELTA_WEIGHTED_TIME + 1;
+enum diskstats_item DISKSTATS_logical_end = MAXTABLE(Item_table);
#undef setNAME
#undef srtNAME
failed = 1;
}
}
- if (i != DISKSTATS_logical_end) {
- fprintf(stderr, "%s: DISKSTATS_logical_end is %d, expected %d\n"
- , __FILE__, DISKSTATS_logical_end, i);
- failed = 1;
- }
if (failed) _Exit(EXIT_FAILURE);
#endif
/* please note,
* this enum MUST be 1 greater than the highest value of any enum */
-enum meminfo_item MEMINFO_logical_end = MEMINFO_SWAP_DELTA_USED + 1;
+enum meminfo_item MEMINFO_logical_end = MAXTABLE(Item_table);
#undef setNAME
#undef RS
failed = 1;
}
}
- if (i != MEMINFO_logical_end) {
- fprintf(stderr, "%s: MEMINFO_logical_end is %d, expected %d\n"
- , __FILE__, MEMINFO_logical_end, i);
- failed = 1;
- }
if (failed) _Exit(EXIT_FAILURE);
#endif
/* please note,
* this enum MUST be 1 greater than the highest value of any enum */
-enum pids_item PIDS_logical_end = PIDS_WCHAN_NAME + 1;
+enum pids_item PIDS_logical_end = MAXTABLE(Item_table);
#undef setNAME
#undef freNAME
failed = 1;
}
}
- if (i != PIDS_logical_end) {
- fprintf(stderr, "%s: PIDS_logical_end is %d, expected %d\n"
- , __FILE__, PIDS_logical_end, i);
- failed = 1;
- }
if (failed) _Exit(EXIT_FAILURE);
#endif
/* please note,
* this enum MUST be 1 greater than the highest value of any enum */
-enum slabinfo_item SLABINFO_logical_end = SLABS_DELTA_SIZE_TOTAL + 1;
+enum slabinfo_item SLABINFO_logical_end = MAXTABLE(Item_table);
#undef setNAME
#undef srtNAME
failed = 1;
}
}
- if (i != SLABINFO_logical_end) {
- fprintf(stderr, "%s: SLABINFO_logical_end is %d, expected %d\n"
- , __FILE__, SLABINFO_logical_end, i);
- failed = 1;
- }
if (failed) _Exit(EXIT_FAILURE);
#endif
#ifdef ENFORCE_LOGICAL
enum stat_item STAT_TIC_highest = STAT_TIC_DELTA_GUEST_NICE;
#endif
-enum stat_item STAT_logical_end = STAT_SYS_DELTA_PROC_RUNNING + 1;
+enum stat_item STAT_logical_end = MAXTABLE(Item_table);
#undef setNAME
#undef srtNAME
failed = 1;
}
}
- if (i != STAT_logical_end) {
- fprintf(stderr, "%s: STAT_logical_end is %d, expected %d\n"
- , __FILE__, STAT_logical_end, i);
- failed = 1;
- }
if (failed) _Exit(EXIT_FAILURE);
#endif
/* please note,
* this enum MUST be 1 greater than the highest value of any enum */
-enum vmstat_item VMSTAT_logical_end = VMSTAT_DELTA_ZONE_RECLAIM_FAILED + 1;
+enum vmstat_item VMSTAT_logical_end = MAXTABLE(Item_table);
#undef setNAME
#undef RS
failed = 1;
}
}
- if (i != VMSTAT_logical_end) {
- fprintf(stderr, "%s: VMSTAT_logical_end is %d, expected %d\n"
- , __FILE__, VMSTAT_logical_end, i);
- failed = 1;
- }
if (failed) _Exit(EXIT_FAILURE);
#endif