|
From: openocd-gerrit <ope...@us...> - 2025-05-01 15:28:25
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 98c09dc257739440f25f5cd23ca9bbd495e5742a (commit)
from 9643379d30fee381e92200ef9ed0caaeae580dad (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 98c09dc257739440f25f5cd23ca9bbd495e5742a
Author: Antonio Borneo <bor...@gm...>
Date: Tue Dec 31 17:01:41 2024 +0100
transport: store the transports sorted by alphabetic name order
While this operation has no real interest so far, it will be used
later to avoid listing twice protocols with the same name.
Change-Id: I59f3634830f94dc992d28863cf29d5d869726918
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8685
Tested-by: jenkins
Reviewed-by: zapb <de...@za...>
diff --git a/src/transport/transport.c b/src/transport/transport.c
index 8a210fe94..755e21054 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -59,7 +59,7 @@ static const struct {
{ TRANSPORT_SWIM, "swim", },
};
-/** List of transports registered in OpenOCD. */
+/** List of transports registered in OpenOCD, alphabetically sorted per name. */
static OOCD_LIST_HEAD(transport_list);
/**
@@ -207,8 +207,14 @@ int transport_register(struct transport *new_transport)
LOG_ERROR("invalid transport %s",
transport_name(new_transport->id));
- /* splice this into the list */
- list_add(&new_transport->lh, &transport_list);
+ /* splice this into the list, sorted in alphabetic order */
+ list_for_each_entry(t, &transport_list, lh) {
+ if (strcmp(transport_name(t->id),
+ transport_name(new_transport->id)) >= 0)
+ break;
+ }
+ list_add_tail(&new_transport->lh, &t->lh);
+
LOG_DEBUG("register '%s' (ID %d)",
transport_name(new_transport->id), new_transport->id);
-----------------------------------------------------------------------
Summary of changes:
src/transport/transport.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|