| Index: courgette/encoded_program.cc
|
| diff --git a/courgette/encoded_program.cc b/courgette/encoded_program.cc
|
| index 59800c50c99d9ec75d7cf2f70994bf9b0b1486c1..76fb33e66815056e591129a74461b095e0cd0f6e 100644
|
| --- a/courgette/encoded_program.cc
|
| +++ b/courgette/encoded_program.cc
|
| @@ -10,11 +10,11 @@
|
| #include <algorithm>
|
| #include <map>
|
| #include <string>
|
| +#include <utility>
|
| #include <vector>
|
|
|
| #include "base/environment.h"
|
| #include "base/logging.h"
|
| -#include "base/memory/scoped_ptr.h"
|
| #include "base/numerics/safe_conversions.h"
|
| #include "base/numerics/safe_math.h"
|
| #include "base/strings/string_number_conversions.h"
|
| @@ -22,7 +22,6 @@
|
| #include "courgette/courgette.h"
|
| #include "courgette/disassembler_elf_32_arm.h"
|
| #include "courgette/streams.h"
|
| -#include "courgette/types_elf.h"
|
|
|
| namespace courgette {
|
|
|
| @@ -781,14 +780,15 @@
|
| return C_OK;
|
| }
|
|
|
| -Status ReadEncodedProgram(SourceStreamSet* streams, EncodedProgram** output) {
|
| - EncodedProgram* encoded = new EncodedProgram();
|
| - if (encoded->ReadFrom(streams)) {
|
| - *output = encoded;
|
| - return C_OK;
|
| - }
|
| - delete encoded;
|
| - return C_DESERIALIZATION_FAILED;
|
| +Status ReadEncodedProgram(SourceStreamSet* streams,
|
| + scoped_ptr<EncodedProgram>* output) {
|
| + output->reset();
|
| + scoped_ptr<EncodedProgram> encoded(new EncodedProgram());
|
| + if (!encoded->ReadFrom(streams))
|
| + return C_DESERIALIZATION_FAILED;
|
| +
|
| + *output = std::move(encoded);
|
| + return C_OK;
|
| }
|
|
|
| Status Assemble(EncodedProgram* encoded, SinkStream* buffer) {
|
| @@ -798,8 +798,4 @@
|
| return C_ASSEMBLY_FAILED;
|
| }
|
|
|
| -void DeleteEncodedProgram(EncodedProgram* encoded) {
|
| - delete encoded;
|
| -}
|
| -
|
| } // namespace courgette
|
|
|