[spinel] simplify functions spinel_*_to_cstr() (#6199)

spinel.c provides functions to convert spinel values to printable
strings. These functions are written using huge switch case statements.
This patch replaces these statements with simple loops over arrays
containing the strings.

Thus, the new code takes 3 time less code than the previous. In add, the
value and the string are no more repeated so the new is less error
prone.

Note: I have used the following commands for the conversion:
  sed -nre 's/case SPINEL_CMD_(.*):/SPINEL_COMMAND_CSTR(\1),/p' spinel.c
  sed -nre 's/case SPINEL_PROP_(.*):/SPINEL_PROP_CSTR(\1),/p' spinel.c
  ...
This commit is contained in:
Jérôme Pouiller
2021-02-25 07:53:27 -08:00
committed by GitHub
parent ee815fed0b
commit 2195f39e94
+448 -1655
View File
File diff suppressed because it is too large Load Diff