seqs_v2_reimpl.nim 514 B

123456789101112131415161718192021222324
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2020 Nim contributors
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. type
  10. NimSeqPayloadReimpl = object
  11. cap: int
  12. data: pointer
  13. NimSeqV2Reimpl = object
  14. len: int
  15. p: ptr NimSeqPayloadReimpl
  16. template frees(s: NimSeqV2Reimpl) =
  17. if s.p != nil and (s.p.cap and strlitFlag) != strlitFlag:
  18. when compileOption("threads"):
  19. deallocShared(s.p)
  20. else:
  21. dealloc(s.p)