Example #1
0
TRI_shape_access_t* TRI_ShapeAccessor (TRI_shaper_t* shaper,
                                       TRI_shape_sid_t sid,
                                       TRI_shape_pid_t pid) {
  TRI_shape_access_t* accessor;
  bool ok;

  accessor = TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shape_access_t), false);

  if (accessor == NULL) {
    TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
    return NULL;
  }

  accessor->_sid = sid;
  accessor->_pid = pid;
  accessor->_code = NULL;
  accessor->_memoryZone = shaper->_memoryZone;

  ok = BytecodeShapeAccessor(shaper, accessor);

  if (ok) {
    return accessor;
  }

  TRI_FreeShapeAccessor(accessor);
  return NULL;
}
Example #2
0
TRI_shape_access_t* TRI_ShapeAccessor (TRI_shaper_t* shaper,
                                       TRI_shape_sid_t sid,
                                       TRI_shape_pid_t pid) {
  TRI_shape_access_t* accessor;
  bool ok;

  accessor = TRI_Allocate(sizeof(TRI_shape_access_t));
  if (!accessor) {
    return NULL;
  }
  accessor->_sid = sid;
  accessor->_pid = pid;
  accessor->_code = NULL;
  ok = BytecodeShapeAccessor(shaper, accessor);

  if (ok) {
    return accessor;
  }

  TRI_FreeShapeAccessor(accessor);
  return NULL;
}
Example #3
0
TRI_shape_access_t* TRI_ShapeAccessor (TRI_shaper_t* shaper,
                                       TRI_shape_sid_t sid,
                                       TRI_shape_pid_t pid) {
  TRI_shape_access_t* accessor = static_cast<TRI_shape_access_t*>(TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shape_access_t), false));

  if (accessor == nullptr) {
    TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
    return nullptr;
  }

  accessor->_sid = sid;
  accessor->_pid = pid;
  accessor->_code = nullptr;
  accessor->_memoryZone = shaper->_memoryZone;

  bool ok = BytecodeShapeAccessor(shaper, accessor);

  if (ok) {
    return accessor;
  }

  TRI_FreeShapeAccessor(accessor);
  return nullptr;
}