libsolc: change return type of compile to non-const

This commit is contained in:
Alex Beregszaszi 2019-12-11 23:51:27 +00:00
parent 2ccf3ea4ab
commit 6e6bc9904f
3 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ extern char const* solidity_version() noexcept
return VersionString.c_str(); return VersionString.c_str();
} }
extern char const* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback, void* _readContext) noexcept extern char* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback, void* _readContext) noexcept
{ {
return solidityAllocations.emplace_back(compile(_input, _readCallback, _readContext)).data(); return solidityAllocations.emplace_back(compile(_input, _readCallback, _readContext)).data();
} }

View File

@ -87,7 +87,7 @@ void solidity_free(char* _data) SOLC_NOEXCEPT;
/// @param _readContext An optional context pointer passed to _readCallback. Can be NULL. /// @param _readContext An optional context pointer passed to _readCallback. Can be NULL.
/// ///
/// @returns A pointer to the result. The pointer returned must be freed by the caller using solidity_free() or solidity_reset(). /// @returns A pointer to the result. The pointer returned must be freed by the caller using solidity_free() or solidity_reset().
char const* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback, void* _readContext) SOLC_NOEXCEPT; char* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback, void* _readContext) SOLC_NOEXCEPT;
/// Frees up any allocated memory. /// Frees up any allocated memory.
/// ///

View File

@ -59,7 +59,7 @@ bool containsError(Json::Value const& _compilerResult, string const& _type, stri
Json::Value compile(string const& _input, CStyleReadFileCallback _callback = nullptr) Json::Value compile(string const& _input, CStyleReadFileCallback _callback = nullptr)
{ {
const char* output_ptr = solidity_compile(_input.c_str(), _callback, nullptr); char* output_ptr = solidity_compile(_input.c_str(), _callback, nullptr);
string output(output_ptr); string output(output_ptr);
solidity_free(output_ptr); solidity_free(output_ptr);
solidity_reset(); solidity_reset();