Make strtabs module usable when avoiding allocations
- resetStringTable proc
This commit is contained in:
parent
650a75beea
commit
524b68d0ed
1 changed files with 6 additions and 0 deletions
|
|
@ -168,6 +168,12 @@ proc newStringTable*(mode: StringTableMode): StringTableRef {.
|
||||||
result.counter = 0
|
result.counter = 0
|
||||||
newSeq(result.data, startSize)
|
newSeq(result.data, startSize)
|
||||||
|
|
||||||
|
proc resetStringTable*(s: var StringTableRef, mode: StringTableMode) =
|
||||||
|
## resets a string table to be empty again.
|
||||||
|
s.mode = mode
|
||||||
|
s.counter = 0
|
||||||
|
s.data.setLen(startSize)
|
||||||
|
|
||||||
proc newStringTable*(keyValuePairs: varargs[string],
|
proc newStringTable*(keyValuePairs: varargs[string],
|
||||||
mode: StringTableMode): StringTableRef {.
|
mode: StringTableMode): StringTableRef {.
|
||||||
rtl, extern: "nst$1WithPairs".} =
|
rtl, extern: "nst$1WithPairs".} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue