Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

json: switch json() to readJson() #82

Closed
wants to merge 1 commit into from

Conversation

proppy
Copy link
Contributor

@proppy proppy commented Apr 15, 2016

  • pass the response as a mutable buffer to get rid of the leaking strdup().
  • rename the function to make it more obvious it's only meant to be called once.
  • delete obsolete json_ field.
  • make response_ and other FirebaseCall member private.

//the buffers.
buffer_ = DynamicJsonBuffer();
return buffer_.parseObject(response());
// NOTE(proppy): this effectively void the response_ buffer.
return buffer_.parseObject(const_cast<char*>(response_.c_str()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While efficient I think we should just make a mutable copy of the response for now to pass in. This seems super "premature optimization" hack.

Copy link
Contributor Author

@proppy proppy Apr 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe &response_[0] would be cleaner and get rid of the const cast. The issue with an intermediate copy is that JsonObject relies on the underlying string for the data storage, so we'd have to add a new member.

- pass the response as a mutable buffer to get rid of the leaking strdup().
- rename the function to make it more obvious it's only meant to be called once.
- delete obsolete json_ field.
- make response_ and other FirebaseCall member private.
@proppy
Copy link
Contributor Author

proppy commented Oct 4, 2016

obsolete

@proppy proppy closed this Oct 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants