Commit b2c959603b2be7a88d4ee0b3584054ec4e4741a5
Committed by
GitHub
Merge pull request #1591 from m-holger/jj
Refactor: use local static variable for JSON schema in `initializeFro…
Showing
1 changed file
with
2 additions
and
3 deletions
libqpdf/QPDFJob_json.cc
| ... | ... | @@ -10,8 +10,6 @@ |
| 10 | 10 | #include <sstream> |
| 11 | 11 | #include <stdexcept> |
| 12 | 12 | |
| 13 | -static JSON JOB_SCHEMA = JSON::parse(QPDFJob::job_json_schema(1).c_str()); | |
| 14 | - | |
| 15 | 13 | namespace |
| 16 | 14 | { |
| 17 | 15 | class Handlers |
| ... | ... | @@ -625,8 +623,9 @@ void |
| 625 | 623 | QPDFJob::initializeFromJson(std::string const& json, bool partial) |
| 626 | 624 | { |
| 627 | 625 | std::list<std::string> errors; |
| 626 | + static const JSON schema = JSON::parse(job_json_schema(1).data()); | |
| 628 | 627 | JSON j = JSON::parse(json); |
| 629 | - if (!j.checkSchema(JOB_SCHEMA, JSON::f_optional, errors)) { | |
| 628 | + if (!j.checkSchema(schema, JSON::f_optional, errors)) { | |
| 630 | 629 | std::ostringstream msg; |
| 631 | 630 | msg << m->message_prefix << ": job json has errors:"; |
| 632 | 631 | for (auto const& error: errors) { | ... | ... |