Remove one simple new/delete pair.

More to come!
This commit is contained in:
2025-02-28 15:02:27 -05:00
parent a836f97b88
commit c6370d1cfd

View File

@ -30,6 +30,8 @@
#include <sys/un.h> #include <sys/un.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <vector>
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/fl_ask.H> #include <FL/fl_ask.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
@ -106,7 +108,7 @@ class DLItem {
int log_state; int log_state;
char *log_text; char *log_text;
time_t init_time; time_t init_time;
char **dl_argv; std::vector< char * > dl_argv;
time_t twosec_time, onesec_time; time_t twosec_time, onesec_time;
int twosec_bytesize, onesec_bytesize; int twosec_bytesize, onesec_bytesize;
int init_bytesize, curr_bytesize, total_bytesize; int init_bytesize, curr_bytesize, total_bytesize;
@ -322,20 +324,19 @@ DLItem::DLItem(const char *full_filename, const char *url, const char *user_agen
if (dStrnAsciiCasecmp(esc_url, "ftp:/", 5) == 0) if (dStrnAsciiCasecmp(esc_url, "ftp:/", 5) == 0)
Filter_smtp_hack(esc_url); Filter_smtp_hack(esc_url);
cookies_path = dStrconcat(dGethomedir(), "/.dillo/cookies.txt", NULL); cookies_path = dStrconcat(dGethomedir(), "/.dillo/cookies.txt", NULL);
dl_argv = new char*[10]; dl_argv.clear();
int i = 0; dl_argv.push_back( (char*)"wget" );
dl_argv[i++] = (char*)"wget";
if (stat(fullname, &ss) == 0) if (stat(fullname, &ss) == 0)
init_bytesize = (int)ss.st_size; init_bytesize = (int)ss.st_size;
dl_argv[i++] = (char*)"-U"; dl_argv.push_back( (char*)"-U" );
dl_argv[i++] = (char*) user_agent; dl_argv.push_back( (char*) user_agent );
dl_argv[i++] = (char*)"-c"; dl_argv.push_back( (char*)"-c" );
dl_argv[i++] = (char*)"--load-cookies"; dl_argv.push_back( (char*)"--load-cookies" );
dl_argv[i++] = cookies_path; dl_argv.push_back( cookies_path );
dl_argv[i++] = (char*)"-O"; dl_argv.push_back( (char*)"-O" );
dl_argv[i++] = fullname; dl_argv.push_back( fullname );
dl_argv[i++] = esc_url; dl_argv.push_back( esc_url );
dl_argv[i++] = NULL; dl_argv.push_back( nullptr );
DataDone = 0; DataDone = 0;
LogDone = 0; LogDone = 0;
@ -435,7 +436,6 @@ DLItem::~DLItem()
free(log_text); free(log_text);
dFree(esc_url); dFree(esc_url);
dFree(cookies_path); dFree(cookies_path);
delete [] dl_argv;
delete(group); delete(group);
} }
@ -471,7 +471,7 @@ void DLItem::child_init()
// set the locale to C for log parsing // set the locale to C for log parsing
setenv("LC_ALL", "C", 1); setenv("LC_ALL", "C", 1);
// start wget // start wget
execvp(dl_argv[0], dl_argv); execvp(dl_argv[0], dl_argv.data());
} }
/* /*