On Sunday 17 May 2009, Michael Bruck wrote:
> -       jtag_command_t **last_cmd;
> -       last_cmd = jtag_get_last_command_p();
> -
> -       *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t));
> -       (*last_cmd)->next = NULL;
> -       last_comand_pointer = &((*last_cmd)->next);
> -       (*last_cmd)->type = JTAG_SCAN;
> 
> +       jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
> +       
> +       jtag_queue_command(cmd);
> +       
> +       cmd->type = JTAG_SCAN;

Seems like a goodly fix ... but, couldn't all of those be wrapped
up in a single function sort of like

        cmd = jtag_alloc_and_queue(JTAG_SCAN);

Or STATEMOVE, PATHMOVE, etc.  Agreed that queue_command() logic
is exactly the error-prone stuff that really *needs* encapsulation;
it should probably stay separate even with an alloc_and_queue().

- Dave
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to