> > How about this patch. this also works. > > > > Is it acceptable ? > > I change the code. > this is more readable.
same, but revert unnecessary change. -------- Hiroshi Ito Media Lab. Inc., URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256
Index: src/jtag/jtag.c =================================================================== --- src/jtag/jtag.c (リビジョン 1183) +++ src/jtag/jtag.c (作業コピー) @@ -401,6 +401,21 @@ return t + offset; } +void cmd_queue_make_align(void) +{ + cmd_queue_page_t *p_page = cmd_queue_pages; + if (!p_page) return; + + while (p_page->next) + p_page = p_page->next; + + if ( p_page->used & (sizeof(void*)-1) ) { + p_page->used += sizeof(void*) - (p_page->used & (sizeof(void*)-1)); + if ( p_page->used >= CMD_QUEUE_PAGE_SIZE ) + p_page->used = CMD_QUEUE_PAGE_SIZE; + } +} + void cmd_queue_free(void) { cmd_queue_page_t *page = cmd_queue_pages; @@ -461,6 +476,7 @@ last_cmd = jtag_get_last_command_p(); /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); (*last_cmd)->next = NULL; last_comand_pointer = &((*last_cmd)->next); @@ -550,6 +566,7 @@ last_cmd = jtag_get_last_command_p(); /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); (*last_cmd)->next = NULL; last_comand_pointer = &((*last_cmd)->next); @@ -614,6 +631,7 @@ } /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); last_comand_pointer = &((*last_cmd)->next); (*last_cmd)->next = NULL; @@ -704,6 +722,7 @@ } /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); last_comand_pointer = &((*last_cmd)->next); (*last_cmd)->next = NULL; @@ -785,6 +804,7 @@ jtag_command_t **last_cmd = jtag_get_last_command_p(); /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); last_comand_pointer = &((*last_cmd)->next); (*last_cmd)->next = NULL; @@ -831,6 +851,7 @@ jtag_command_t **last_cmd = jtag_get_last_command_p(); /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); last_comand_pointer = &((*last_cmd)->next); (*last_cmd)->next = NULL; @@ -887,6 +908,7 @@ int i; /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); last_comand_pointer = &((*last_cmd)->next); (*last_cmd)->next = NULL; @@ -907,6 +929,7 @@ jtag_command_t **last_cmd = jtag_get_last_command_p(); /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); (*last_cmd)->next = NULL; last_comand_pointer = &((*last_cmd)->next); @@ -1039,6 +1062,7 @@ jtag_command_t **last_cmd = jtag_get_last_command_p(); /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); (*last_cmd)->next = NULL; last_comand_pointer = &((*last_cmd)->next); @@ -1065,6 +1089,7 @@ jtag_command_t **last_cmd = jtag_get_last_command_p(); /* allocate memory for a new list member */ + cmd_queue_make_align(); *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); (*last_cmd)->next = NULL; last_comand_pointer = &((*last_cmd)->next);
_______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development