This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7501

-- gerrit

commit dc10a4c8c63130762b12697cdcb86096224218c6
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Mon Dec 19 20:56:40 2022 +0100

    target: arm_tpiu_swo: rewrite command 'tpiu names' as COMMAND_HANDLER
    
    While there, format in a human readable way the output list by
    using one line per tpiu name.
    
    Change-Id: I937c92b6c1e92509cf8aa96be1517a51bc363600
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c
index 3cf306377c..55201e6fe0 100644
--- a/src/target/arm_tpiu_swo.c
+++ b/src/target/arm_tpiu_swo.c
@@ -981,20 +981,17 @@ err_exit:
        return JIM_ERR;
 }
 
-static int jim_arm_tpiu_swo_names(Jim_Interp *interp, int argc, Jim_Obj *const 
*argv)
+COMMAND_HANDLER(handle_arm_tpiu_swo_names)
 {
        struct arm_tpiu_swo_object *obj;
 
-       if (argc != 1) {
-               Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
-               return JIM_ERR;
-       }
-       Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));
-       list_for_each_entry(obj, &all_tpiu_swo, lh) {
-               Jim_ListAppendElement(interp, Jim_GetResult(interp),
-                       Jim_NewStringObj(interp, obj->name, -1));
-       }
-       return JIM_OK;
+       if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       list_for_each_entry(obj, &all_tpiu_swo, lh)
+               command_print(CMD, "%s", obj->name);
+
+       return ERROR_OK;
 }
 
 static int jim_arm_tpiu_swo_init(Jim_Interp *interp, int argc, Jim_Obj *const 
*argv)
@@ -1185,7 +1182,7 @@ static const struct command_registration 
arm_tpiu_swo_subcommand_handlers[] = {
        {
                .name = "names",
                .mode = COMMAND_ANY,
-               .jim_handler = jim_arm_tpiu_swo_names,
+               .handler = handle_arm_tpiu_swo_names,
                .usage = "",
                .help = "Lists all registered TPIU and SWO objects by name",
        },

-- 

Reply via email to