Commit c5a627ff2fcc177ebeab8b90d115a6d24ad75f6d
1 parent
3b6b3213
Refactor: use local static variable for JSON schema in `initializeFromJson` and …
…remove unused global variable `JOB_SCHEMA`.
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) { | ... | ... |