From 2717b21b8791d34da877c9a2198d7e97a9c3cbef Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Tue, 1 Oct 2024 17:12:56 +0200 Subject: [PATCH] avoid threadvar (#107) --- confutils/winreg/reader.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/confutils/winreg/reader.nim b/confutils/winreg/reader.nim index 6d7918f..e3d8129 100644 --- a/confutils/winreg/reader.nim +++ b/confutils/winreg/reader.nim @@ -71,18 +71,18 @@ proc readValue*[T](r: var WinregReader, value: var T) elif T is (object or tuple): type T = type(value) when T.totalSerializedFields > 0: - let fields = T.fieldReadersTable(WinregReader) + const fields = T.fieldReadersTable(WinregReader) var expectedFieldPos = 0 r.key.add "" value.enumInstanceSerializedFields(fieldName, field): when T is tuple: r.key[^1] = $expectedFieldPos - var reader = fields[][expectedFieldPos].reader + var reader = fields[expectedFieldPos].reader expectedFieldPos += 1 else: r.key[^1] = fieldName - var reader = findFieldReader(fields[], fieldName, expectedFieldPos) + var reader = findFieldReader(fields, fieldName, expectedFieldPos) if reader != nil: reader(value, r)