haskell / haskell/bytestring

Audit `foreign import ccall` types

未关闭
#653 0 条评论 0 个 reaction 已指派 1 人 已被 @clyring 认领 在 GitHub 查看
bug
主要语言
Haskell
星标
301
派生
144
平均合并
7 天 22 小时
30 天内合并 PR
1

描述

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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。