haskell / haskell/bytestring

Audit `foreign import ccall` types

Open
#653 0 comments 0 reactions 1 assignee Claimed by @clyring View on GitHub
bug
Dominant language
Haskell
Stars
301
Forks
144
Avg merge
7d 22h
Merged PRs (30d)
1

Description

In [this comment](https://github.com/haskell/bytestring/pull/631#discussion_r1451112873) it was noticed that we have a mismatch between the actual C prototype of `sbs_elem_index` and the foreign import in our Haskell code:

```c
ptrdiff_t
sbs_elem_index(const void *s,
int c,
size_t n)
{ // ...
```

```haskell
foreign import ccall unsafe "static sbs_elem_index"
c_elem_index :: ByteArray# -> Word8 -> CSize -> IO CPtrdiff
```

Notice that for the second argument we have `Word8` on the Haskell side and `int` on the C side.

I will audit our foreign imports for similar mistakes.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.