aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFJob_argv.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-01-23 00:57:01 +0100
committerJay Berkenbilt <ejb@ql.org>2022-01-30 19:11:03 +0100
commitb9cd693a5b36b8b0246822cb97386792045179ec (patch)
tree60a4906d69648592c213ea513d37e54aea43329a /libqpdf/QPDFJob_argv.cc
parentd526d4c17f9de11c4a7a2cd5f27e7e4419d9b33a (diff)
downloadqpdf-b9cd693a5b36b8b0246822cb97386792045179ec.tar.zst
QPDFJob: allocate QPDFArgParser on stack
The previous commits have removed all references to memory from QPDFArgParser from QPDFJob. This commit removes the constraint that QPDFArgParser remain in scope. This is a prerequisite to allowing JSON as an alternative way to initialize QPDFJob and to initialize it directly using a public API.
Diffstat (limited to 'libqpdf/QPDFJob_argv.cc')
-rw-r--r--libqpdf/QPDFJob_argv.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc
index 316beda0..8da5e836 100644
--- a/libqpdf/QPDFJob_argv.cc
+++ b/libqpdf/QPDFJob_argv.cc
@@ -1529,11 +1529,8 @@ QPDFJob::initializeFromArgv(int argc, char* argv[], char const* progname_env)
{
progname_env = "QPDF_EXECUTABLE";
}
- // QPDFArgParser must stay in scope for the life of the QPDFJob
- // object since it holds dynamic memory used for argv, which is
- // pointed to by other member variables.
- this->m->ap = std::make_shared<QPDFArgParser>(argc, argv, progname_env);
- setMessagePrefix(this->m->ap->getProgname());
- ArgParser ap(*this->m->ap, *this);
+ QPDFArgParser qap(argc, argv, progname_env);
+ setMessagePrefix(qap.getProgname());
+ ArgParser ap(qap, *this);
ap.parseOptions();
}