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

handle safe-string #47

Merged
merged 1 commit into from
Mar 13, 2021
Merged

handle safe-string #47

merged 1 commit into from
Mar 13, 2021

Conversation

olafhering
Copy link
Contributor

String_val() will return 'const char *'.

Signed-off-by: Olaf Hering olaf@aepfle.de

sha1_stubs.c Outdated
@@ -154,7 +154,7 @@ CAMLprim value stub_sha1_to_bin(value digest)
CAMLlocal1(result);

result = caml_alloc_string(20);
sha1_to_bin((sha1_digest *) digest, String_val(result));
sha1_to_bin((sha1_digest *) digest, &Byte(String_val(result), 0));
Copy link
Contributor

Choose a reason for hiding this comment

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

Cleaner to use Bytes_val(result).

@olafhering
Copy link
Contributor Author

olafhering commented Jul 22, 2020 via email

@nojb
Copy link
Contributor

nojb commented Jul 22, 2020

This macro is available since 4.06+, is such new dependency constraint intended?

OK, then you can use &Byte(result, 0) instead of &Byte(String_val(result),0) (it is equivalent, but the first one is "more correct").
See https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#ss:c-block-access

String_val() will return 'const char *'.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
@olafhering
Copy link
Contributor Author

I have updated the change.

@olafhering
Copy link
Contributor Author

Any idea if this MR is acceptable now?

Copy link
Contributor

@nojb nojb left a comment

Choose a reason for hiding this comment

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

LGTM

@nojb
Copy link
Contributor

nojb commented Mar 13, 2021

Changes look good, but it is up to the maintainer to merge it. cc @djs55

@djs55
Copy link
Owner

djs55 commented Mar 13, 2021

Thanks for the ping and the PR! Looks fine to me.

@djs55 djs55 merged commit ac1d5c0 into djs55:master Mar 13, 2021
djs55 added a commit to djs55/opam-repository that referenced this pull request Mar 15, 2021
CHANGES:

- Handle `safe-string` by @olafhering, reviewed by @nojb (djs55/ocaml-sha#47)
- Remove `--dev` option from `dune` invocation by @arthurteisseire (djs55/ocaml-sha#48)
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