File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -146,19 +146,18 @@ WARDuino *wac = WARDuino::instance();
146146Module *m;
147147
148148struct debugger_options {
149- const char * socket;
149+ int socket;
150150 bool no_socket;
151151};
152152
153- void * setupDebuggerCommunication (debugger_options * options) {
153+ void setupDebuggerCommunication (debugger_options & options) {
154154 dbg_info (" \n === STARTED DEBUGGER (in separate thread) ===\n " );
155155 // Start debugger
156156 Channel *duplex;
157- if (options-> no_socket ) {
157+ if (options. no_socket ) {
158158 duplex = new Duplex (stdin, stdout);
159159 } else {
160- int port = std::stoi (options->socket );
161- duplex = new WebSocket (port);
160+ duplex = new WebSocket (options.socket );
162161 }
163162
164163 wac->debugger ->setChannel (duplex);
@@ -391,12 +390,10 @@ int main(int argc, const char *argv[]) {
391390 // Start debugger (new thread)
392391 std::thread communication;
393392 if (!no_debug) {
394- auto *options =
395- (debugger_options *)malloc (sizeof (struct debugger_options ));
396- options->no_socket = no_socket;
397- options->socket = socket;
393+ debugger_options options = debugger_options ();
394+ options.no_socket = no_socket;
395+ options.socket = std::stoi (socket);
398396 setupDebuggerCommunication (options);
399- free (options);
400397
401398 communication = std::thread (startDebuggerCommunication);
402399 }
You can’t perform that action at this time.
0 commit comments