Ejemplo n.º 1
0
static void FreeScope (TRI_aql_scope_t* const scope) {
  size_t i, n;

  // free variables lookup hash
  n = scope->_variables._nrAlloc;
  for (i = 0; i < n; ++i) {
    TRI_aql_variable_t* variable = scope->_variables._table[i];

    if (variable) {
      TRI_FreeVariableAql(variable);
    }
  }

  TRI_DestroyAssociativePointer(&scope->_variables);

  if (scope->_ranges) {
    // free ranges if set
    TRI_FreeAccessesAql(scope->_ranges);
  }

  for (i = 0; i < scope->_sorts._length; ++i) {
    char* criterion = (char*) TRI_AtVectorPointer(&scope->_sorts, i);

    TRI_Free(TRI_UNKNOWN_MEM_ZONE, criterion);
  }

  TRI_DestroyVectorPointer(&scope->_sorts);

  TRI_Free(TRI_UNKNOWN_MEM_ZONE, scope);
}
Ejemplo n.º 2
0
void TRI_FreeCollectionHintAql (TRI_aql_collection_hint_t* const hint) {
  assert(hint);

  if (hint->_ranges != NULL) {
    TRI_FreeAccessesAql(hint->_ranges);
  }

  if (hint->_index != NULL) {
    TRI_FreeIndexAql(hint->_index);
  }

  if (hint->_variableName != NULL) {
    TRI_Free(TRI_UNKNOWN_MEM_ZONE, hint->_variableName);
  }

  TRI_Free(TRI_UNKNOWN_MEM_ZONE, hint);
}
void TRI_SetCurrentRangesStatementWalkerAql (TRI_aql_statement_walker_t* const walker,
        TRI_vector_pointer_t* ranges) {
    TRI_aql_scope_t* scope = TRI_GetCurrentScopeStatementWalkerAql(walker);

    assert(scope);

    if (ranges != NULL) { // ranges may be NULL
        TRI_vector_pointer_t* oldRanges = scope->_ranges;

        if (oldRanges != NULL) {
            // free old value
            TRI_FreeAccessesAql(oldRanges);
        }

        // set to new value
        scope->_ranges = ranges;
    }
}
Ejemplo n.º 4
0
static void FreeScope (TRI_aql_scope_t* const scope) {
  size_t i, n;

  // free variables lookup hash
  n = scope->_variables._nrAlloc;
  for (i = 0; i < n; ++i) {
    TRI_aql_variable_t* variable = scope->_variables._table[i];

    if (variable) {
      TRI_FreeVariableAql(variable);
    }
  }
  
  TRI_DestroyAssociativePointer(&scope->_variables);
  
  if (scope->_ranges) {
    // free ranges if set
    TRI_FreeAccessesAql(scope->_ranges);
  }

  TRI_Free(TRI_UNKNOWN_MEM_ZONE, scope);
}