maybe something for readability here:
cmdidx < (sizeof(internal_handled_cmds)/sizeof(handled_xxxx_cmd_type))