less hardcoded sizes and more ARRAYLEN

This commit is contained in:
Philippe Teuwen 2019-07-31 23:44:53 +02:00
commit f276dca3f1
16 changed files with 43 additions and 53 deletions

View file

@ -40,10 +40,9 @@ static const PlusErrorsElm PlusErrors[] = {
{0x0f, "General Manipulation Error. Failure in the operation of the PICC (cannot write to the data block), etc."},
{0x90, "OK"},
};
int PlusErrorsLen = sizeof(PlusErrors) / sizeof(PlusErrorsElm);
const char *mfpGetErrorDescription(uint8_t errorCode) {
for (int i = 0; i < PlusErrorsLen; i++)
for (int i = 0; i < ARRAYLEN(PlusErrors); i++)
if (errorCode == PlusErrors[i].Code)
return PlusErrors[i].Description;