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

feat(native): add Locale module #938

Merged
merged 11 commits into from
Jul 3, 2020
Merged

feat(native): add Locale module #938

merged 11 commits into from
Jul 3, 2020

Conversation

zbaylin
Copy link
Member

@zbaylin zbaylin commented Jul 3, 2020

This is to get the current user (and maybe eventually system) locale information.

src/Native/locale.c Outdated Show resolved Hide resolved
src/Core/App.re Outdated
@@ -255,6 +255,10 @@ let start = init => {

Revery_Native.initApp();

AppLog.infof(m =>
m("Operating in locale : %s", Revery_Native.Locale.getUser())
Copy link
Member

Choose a reason for hiding this comment

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

Good idea to add a log for this

@zbaylin zbaylin requested a review from bryphe July 3, 2020 15:53
camlRet = caml_copy_string(ret);
free(ret);
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look like it's hitting the Windows path - just linux.

I guess we should check:

  1. Does ret need to be freed for Apple?
  2. Does ret need to be freed for Windows? I think the answer is yes
  3. Does ret need to be freed for Linux?

If the answer is to all of those, we could free(ret) after the #ifdef/#endif block. Otherwise, if we just need to free some of them - we'd need to include it in the platform condition

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that was my bad. I fixed it in eedb70b. On Linux and macOS we dont need to free (in fact we segfault if we do, predictably). I added a shouldFree variable that I think makes it a bit clearer. Let me know if you think this is better!

Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me! Thanks @zbaylin

@zbaylin zbaylin merged commit 0a1c0a7 into master Jul 3, 2020
@Et7f3 Et7f3 deleted the feat/native/locale branch July 5, 2020 10:23
@Et7f3 Et7f3 restored the feat/native/locale branch July 5, 2020 10:24
@Et7f3 Et7f3 deleted the feat/native/locale branch July 5, 2020 10: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.

2 participants