Skip to content
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

CBL-5845: Port LocalRef handling from 3.1 #305

Merged
merged 3 commits into from
Jun 20, 2024
Merged

CBL-5845: Port LocalRef handling from 3.1 #305

merged 3 commits into from
Jun 20, 2024

Conversation

bmeike
Copy link
Contributor

@bmeike bmeike commented Jun 18, 2024

This is a pretty big commit. There are two functional changes:

  • Use FLEncoder_GetErrorMessage to give better error messages when the encoder fails
  • LocalRefs are explicitly freed as soon as possible (DeleteLocalRef, or DetachCurrentThread)

The rest of the changes (that is, most of them) are just an attempt to normalize the code:

  • logError renamed as jniLog, because it is used to log things other than errors
  • pointers are explicitly compared to nullptr for verification
  • SliceResults are verified using their bool op
  • "auto" used only if the right side of the assignment makes the type absolutely clear.
  • FSSliceResults are freed with FLSliceResult_Release; C4Slices are freed with its alias c4slice_free
  • boolean returns are now named "ok", pretty much universally.
  • some line wrapping to make the code fit on the page

@@ -749,17 +754,23 @@ Java_com_couchbase_lite_internal_core_impl_NativeC4KeyPair_generateSelfSignedCer
auto keys = (C4KeyPair *) c4KeyPair;

int size = env->GetArrayLength(nameComponents);
auto subjectName = new C4CertNameComponent[size];
C4CertNameComponent *subjectName = new C4CertNameComponent[size];
Copy link
Member

Choose a reason for hiding this comment

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

I see what you are doing with the rejection of auto but it was kind of made for situations like this where the object name shows up twice in one line (comment only, not a review)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah.... Overzealous. WIll use "auto" with "new" in the future.

@bmeike bmeike force-pushed the pr/CBL-5845 branch 2 times, most recently from 4cc840e to 2dbf0c8 Compare June 18, 2024 22:02
@bmeike bmeike merged commit 37087aa into master Jun 20, 2024
@bmeike bmeike deleted the pr/CBL-5845 branch June 20, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants