@@ -82,7 +82,7 @@ int cmd_argc;
8282char ** cmd_argv;
8383static const char * log_filename = nullptr ;
8484static const char * metrics_filename = nullptr ;
85- static std::set<std::string>* commands = nullptr ;
85+ static std::unique_ptr<std:: set<std::string>> commands;
8686static bool no_settings = false ;
8787static bool minimize = false ;
8888
@@ -296,7 +296,6 @@ int main(int argc, char* argv[])
296296 // Set argc to 1 so Tcl_Main doesn't source any files.
297297 // Tcl_Main never returns.
298298 Tcl_Main (1 , argv, ord::tclAppInit);
299- delete commands;
300299 return 0 ;
301300}
302301
@@ -373,9 +372,9 @@ std::string findPathToTclreadlineInit(Tcl_Interp* interp)
373372
374373static int TraceTclCommand (
375374 ClientData clientData,
376- Tcl_Interp * interp,
377- int level,
378- const char * command,
375+ Tcl_Interp* interp,
376+ int /* level */ ,
377+ const char * /* command */ ,
379378 Tcl_Command commandToken,
380379 int objc,
381380 Tcl_Obj *const objv[])
@@ -391,7 +390,12 @@ static int TraceTclCommand(
391390 }
392391 utl::Logger* logger = ord::OpenRoad::openRoad ()->getLogger ();
393392 if (commands->count (Tcl_GetString (objv[0 ]))){
394- logger->report (" [CMD] " +cmd_str);
393+ Tcl_Obj *fullName = Tcl_NewObj ();
394+ Tcl_GetCommandFullName (interp, commandToken, fullName);
395+ string fullName_str = Tcl_GetString (fullName);
396+ if (fullName_str.compare (0 , 7 , " ::sta::" ) ==0 ){
397+ logger->report (" [CMD] " +cmd_str);
398+ }
395399 }
396400 return TCL_OK;
397401}
@@ -456,7 +460,7 @@ static int tclAppInit(int& argc,
456460 showSplash ();
457461 }
458462
459- commands = new std::set<std::string>();
463+ commands = std::make_unique<std:: set<std::string> >();
460464 if (Tcl_Eval (interp, " array names sta::cmd_args" ) == TCL_OK) {
461465 Tcl_Obj* cmd_names = Tcl_GetObjResult (interp);
462466 int cmd_size;
@@ -471,9 +475,9 @@ static int tclAppInit(int& argc,
471475 Tcl_CreateObjTrace (
472476 interp,
473477 0 ,
474- TCL_ALLOW_INLINE_COMPILATION, // In this case, traces on built-in commands may or may not result in trace callbacks.
478+ TCL_ALLOW_INLINE_COMPILATION,
475479 TraceTclCommand,
476- commands,
480+ commands. get () ,
477481 nullptr
478482 );
479483 const char * threads = findCmdLineKey (argc, argv, " -threads" );
0 commit comments