AtPtr method

PP AtPtr(
  1. String key, [
  2. int count = 1
])

Implementation

PP AtPtr(String key, [int count = 1]) {
  final existing = stringSlotsPtrsKeyed[key];
  if (existing != null) {
    final (ptr, currentCount) = existing;
    if (count <= currentCount) {
      stringSlotsPtrsKeyed[key] = (ptr, count);
      return ptr;
    }
    freePPFunc(ptr);
  }
  final ptr = ptrAllocatorFunc(ptrByteSize * count);
  stringSlotsPtrsKeyed[key] = (ptr, count);
  return ptr;
}