Пример #1
0
static inline void InitList (TRI_memory_zone_t* zone,
                             TRI_json_t* result,
                             size_t initialSize) {
  result->_type = TRI_JSON_LIST;
  if (initialSize == 0) {
    TRI_InitVector(&result->_value._objects, zone, sizeof(TRI_json_t));
  }
  else {
    TRI_InitVector2(&result->_value._objects, zone, sizeof(TRI_json_t), initialSize);
  }
}
Пример #2
0
static inline void InitArray (TRI_memory_zone_t* zone,
                              TRI_json_t* result,
                              size_t initialSize) {
  result->_type = TRI_JSON_ARRAY;

  if (initialSize == 0) {
    TRI_InitVector(&result->_value._objects, zone, sizeof(TRI_json_t));
  }
  else {
    // need to allocate twice the space because for each array entry,
    // we need one object for the attribute key, and one for the attribute value
    TRI_InitVector2(&result->_value._objects, zone, sizeof(TRI_json_t), 2 * initialSize);
  }
}
Пример #3
0
void TRI_Init2ArrayJson (TRI_memory_zone_t* zone, 
                         TRI_json_t* result, 
                         size_t initialSize) {
  result->_type = TRI_JSON_ARRAY;
  TRI_InitVector2(&result->_value._objects, zone, sizeof(TRI_json_t), initialSize);
}