• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisióncdc39c6aaea33a9a47657f7798090ca973053a2f (tree)
Tiempo2022-07-25 23:12:00
AutorFrancesco Dolcini <francesco.dolcini@tora...>
CommiterStefano Babic

Log Message

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Cambiar Resumen

Diferencia incremental

--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -381,8 +381,7 @@ int read_tdx_cfg_block(void)
381381 }
382382
383383 /* Cap product id to avoid issues with a yet unknown one */
384- if (tdx_hw_tag.prodid >= (sizeof(toradex_modules) /
385- sizeof(toradex_modules[0])))
384+ if (tdx_hw_tag.prodid >= ARRAY_SIZE(toradex_modules))
386385 tdx_hw_tag.prodid = 0;
387386
388387 out:
@@ -822,8 +821,7 @@ static int get_cfgblock_carrier_interactive(void)
822821
823822 printf("Supported carrier boards:\n");
824823 printf("CARRIER BOARD NAME\t\t [ID]\n");
825- for (int i = 0; i < sizeof(toradex_carrier_boards) /
826- sizeof(toradex_carrier_boards[0]); i++)
824+ for (int i = 0; i < ARRAY_SIZE(toradex_carrier_boards); i++)
827825 if (toradex_carrier_boards[i])
828826 printf("%s \t\t [%d]\n", toradex_carrier_boards[i], i);
829827