コード例 #1
0
ファイル: json-shaper.c プロジェクト: santanu1122/ArangoDB
void TRI_DestroyShaper (TRI_shaper_t* shaper) {
  size_t n = shaper->_attributePathsByName._nrAlloc;
  size_t i;

  // only free pointers in attributePathsByName
  // (attributePathsByPid contains the same pointers!)
  for (i = 0; i < n; ++i) {
    void* data = shaper->_attributePathsByName._table[i];

    if (data) {
      TRI_Free(shaper->_memoryZone, data);
    }
  }

  TRI_DestroyAssociativeSynced(&shaper->_attributePathsByName);
  TRI_DestroyAssociativeSynced(&shaper->_attributePathsByPid);

  TRI_DestroyMutex(&shaper->_attributePathLock);
}
コード例 #2
0
ファイル: json-shaper.c プロジェクト: frankmayer/ArangoDB
int TRI_InitShaper (TRI_shaper_t* shaper, TRI_memory_zone_t* zone) {
  int res;

  shaper->_memoryZone = zone;

  res = TRI_InitAssociativeSynced(&shaper->_attributePathsByName,
                                  zone,
                                  HashNameKeyAttributePath,
                                  HashNameElementAttributePath,
                                  EqualNameKeyAttributePath,
                                  0);

  if (res != TRI_ERROR_NO_ERROR) {
    return res;
  }

  res = TRI_InitAssociativeSynced(&shaper->_attributePathsByPid,
                                  zone,
                                  HashPidKeyAttributePath,
                                  HashPidElementAttributePath,
                                  EqualPidKeyAttributePath,
                                  0);

  if (res != TRI_ERROR_NO_ERROR) {
    TRI_DestroyAssociativeSynced(&shaper->_attributePathsByName);

    return res;
  }

  TRI_InitMutex(&shaper->_attributePathLock);

  shaper->_nextPid = 1;

  shaper->lookupAttributePathByPid = LookupPidAttributePath;
  shaper->findOrCreateAttributePathByName = FindOrCreateAttributePathByName;
  shaper->lookupAttributePathByName = LookupAttributePathByName;

  return TRI_ERROR_NO_ERROR;
}
コード例 #3
0
ファイル: associative.cpp プロジェクト: CoDEmanX/ArangoDB
void TRI_FreeAssociativeSynced (TRI_memory_zone_t* zone, TRI_associative_synced_t* array) {
  TRI_DestroyAssociativeSynced(array);
  TRI_Free(zone, array);
}
コード例 #4
0
void TRI_FreeAssociativeSynced (TRI_associative_synced_t* array) {
  TRI_DestroyAssociativeSynced(array);
  TRI_Free(array);
}