applies gc-safety to zkey parser

This commit is contained in:
Ben 2025-11-13 13:09:45 +01:00
parent bbfb4d5f7f
commit 3ff657db48
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
2 changed files with 4 additions and 4 deletions

View File

@ -61,8 +61,8 @@ proc readSection[T] ( expectedMagic: string
, stream: Stream
, user: var T
, callback: SectionCallback[T]
, filt: proc(_: int): bool {.raises: [IOError, OSError].}
) {.raises: [IOError, OSError].} =
, filt: proc(_: int): bool {.gcsafe, raises: [IOError, OSError].}
) {.gcsafe, raises: [IOError, OSError].} =
let sectId = int( stream.readUint32() )
let sectLen = int( stream.readUint64() )
@ -78,7 +78,7 @@ proc parseContainer*[T] ( expectedMagic: string
, fname: string
, user: var T
, callback: SectionCallback[T]
, filt: proc(_: int): bool {.raises: [IOError, OSError].}
, filt: proc(_: int): bool {.gcsafe, raises: [IOError, OSError].}
) {.raises: [IOError, OSError].} =
let stream = newFileStream(fname, mode = fmRead)

View File

@ -238,7 +238,7 @@ proc zkeyCallback(stream: Stream, sectId: int, sectLen: int, user: var ZKey) =
of 9: parseSection9_PointsH1( stream, user, sectLen )
else: discard
proc parseZKey* (fname: string): ZKey =
proc parseZKey* (fname: string): ZKey {.gcsafe.} =
var zkey : ZKey
parseContainer( "zkey", 1, fname, zkey, zkeyCallback, proc (id: int): bool = id == 1 )
parseContainer( "zkey", 1, fname, zkey, zkeyCallback, proc (id: int): bool = id == 2 )