jtag: commands: save a pointer to list tail
[openocd.git] / src / jtag / commands.c
index 5e06840a693680a5604cf4e06ea10abf166b5a3a..750ebab0d6eab01bd661aaa79e8a00aae09f8d38 100644 (file)
 #include "commands.h"
 
 struct cmd_queue_page {
+       struct cmd_queue_page *next;
        void *address;
        size_t used;
-       struct cmd_queue_page *next;
 };
 
 #define CMD_QUEUE_PAGE_SIZE (1024 * 1024)
 static struct cmd_queue_page *cmd_queue_pages;
+static struct cmd_queue_page *cmd_queue_pages_tail;
 
 struct jtag_command *jtag_command_queue;
 static struct jtag_command **next_command_pointer = &jtag_command_queue;
@@ -100,8 +101,7 @@ void *cmd_queue_alloc(size_t size)
        /* Done... */
 
        if (*p_page) {
-               while ((*p_page)->next)
-                       p_page = &((*p_page)->next);
+               p_page = &cmd_queue_pages_tail;
                if (CMD_QUEUE_PAGE_SIZE - (*p_page)->used < size)
                        p_page = &((*p_page)->next);
        }
@@ -113,6 +113,7 @@ void *cmd_queue_alloc(size_t size)
                                        CMD_QUEUE_PAGE_SIZE : size;
                (*p_page)->address = malloc(alloc_size);
                (*p_page)->next = NULL;
+               cmd_queue_pages_tail = *p_page;
        }
 
        offset = (*p_page)->used;
@@ -134,6 +135,7 @@ static void cmd_queue_free(void)
        }
 
        cmd_queue_pages = NULL;
+       cmd_queue_pages_tail = NULL;
 }
 
 void jtag_command_queue_reset(void)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)