library: eliminate one potential source of human error
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 commit09e1886c9e
. 08/2020, added MAXTABLE macro commitc865b06c30
. 08/2020, introduced ITEMTABLE_DEBUG commit92d0297e1e
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@@ -311,7 +311,7 @@ static struct {
|
||||
|
||||
/* 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
|
||||
@@ -753,11 +753,6 @@ PROCPS_EXPORT int procps_slabinfo_new (
|
||||
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
|
||||
|
||||
|
Reference in New Issue
Block a user