-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional argument names to all extern "C" fn types #484
Conversation
0a44231
to
1bcc9fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
libwasmvm/src/db.rs
Outdated
gas_meter: *mut gas_meter_t, | ||
gas_used: *mut u64, | ||
key: U8SliceView, | ||
result_out: *mut UnmanagedVector, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contrary to the comment that was here, this is not really a result. It just contains the value of the kv.Get
call, so I would suggest using value_out
as name. That name also is more in line with the other db calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I'll make the this name more specific. I was more thinking about "return value" here. We have the same case in fn next_key_or_val(
. What would be a good name for that? This is the "key or value output, depending on the caller"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, the naming for that one gets a bit cumbersome. I would either go with "key_or_val_out" to stay in line with the others or just plain "output" which is much simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I just noticed that humanize_address and canonicalize_address also have the same "result" naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Will fix all of those to ensure we don't have a different meaning of "result" than the one we are used to from Rust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Could you double check the last commit? I think the code got a bit cleaner but I am scared I might have messed something up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Both the added comments and the query_raw change are correct as far as I can tell.
let result = serde_json::from_slice(&bin_result).or_else(|e| { | ||
Ok(SystemResult::Err(SystemError::InvalidResponse { | ||
let sys_result: SystemResult<_> = serde_json::from_slice(&bin_result).unwrap_or_else(|e| { | ||
SystemResult::Err(SystemError::InvalidResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should behave the same 👍
That type annotation isn't needed, but I'm fine with leaving it in for clarity.
@@ -144,7 +144,7 @@ impl GoIter { | |||
iterator: iterator_t, | |||
gas_meter: *mut gas_meter_t, | |||
gas_limit: *mut u64, | |||
result_out: *mut UnmanagedVector, | |||
key_or_value_out: *mut UnmanagedVector, // key if called from next_key; value if called from next_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
No description provided.