haskell / haskell/bytestring

Audit `foreign import ccall` types

Aperta
#653 0 commenti 0 reazioni 1 assegnatario Rivendicata da @clyring Vedi su GitHub
bug
Lingua principale
Haskell
Stelle
301
Fork
144
Merge medio
7g 22h
PR unite (30g)
1

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.