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/+/8814

-- gerrit

commit a9fa444ecfeabd25fee27c532838f9d777ac6ab8
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Sun Mar 23 15:27:37 2025 +0100

    target: remove events that are set to empty string
    
    Current code allows replacing the body of an existing event, but
    it doesn't provides a way to remove it.
    Replacing the event with an empty string makes the event still
    present and visible through
            $target_name eventlist
    
    The presence of empty events makes more complex checking for the
    event not set or set to empty.
    
    Remove the event when set to empty string.
    
    While there, add 'Jim_Length' to the list of allowed CamelCase
    symbols, avoiding the associated checkpatch error.
    
    Change-Id: I1ec2e1a71d298a0eba0b6863902645bcc6c4cb09
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/target/target.c b/src/target/target.c
index dc16874437..b3ad35dc7f 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5013,6 +5013,17 @@ no_params:
                                                LOG_INFO("DEPRECATED target 
event %s; use TPIU events {pre,post}-{enable,disable}", n->name);
                                        /* END_DEPRECATED_TPIU */
 
+                                       jim_getopt_obj(goi, &o);
+                                       if (Jim_Length(o) == 0) {
+                                               /* empty action, drop existing 
one */
+                                               if (teap) {
+                                                       list_del(&teap->list);
+                                                       
Jim_DecrRefCount(teap->interp, teap->body);
+                                                       free(teap);
+                                               }
+                                               break;
+                                       }
+
                                        bool replace = true;
                                        if (!teap) {
                                                /* create new */
@@ -5021,7 +5032,6 @@ no_params:
                                        }
                                        teap->event = n->value;
                                        teap->interp = goi->interp;
-                                       jim_getopt_obj(goi, &o);
                                        if (teap->body)
                                                Jim_DecrRefCount(teap->interp, 
teap->body);
                                        teap->body  = 
Jim_DuplicateObj(goi->interp, o);
diff --git a/tools/scripts/camelcase.txt b/tools/scripts/camelcase.txt
index b787902006..6c6c28daa5 100644
--- a/tools/scripts/camelcase.txt
+++ b/tools/scripts/camelcase.txt
@@ -122,6 +122,7 @@ Jim_GetWide
 Jim_IncrRefCount
 Jim_InitStaticExtensions
 Jim_Interp
+Jim_Length
 Jim_ListAppendElement
 Jim_ListGetIndex
 Jim_ListLength

-- 

Reply via email to