1
0
Fork 0

moved magic number to function

This commit is contained in:
Jan Steemann 2014-05-16 19:05:54 +02:00
parent 81c68927aa
commit d5200f26d7
4 changed files with 18 additions and 29 deletions

View File

@ -536,8 +536,8 @@ SkiplistIndex* SkiplistIndex_new (TRI_primary_collection_t* primary,
skiplistIndex->_numFields = numFields; skiplistIndex->_numFields = numFields;
skiplistIndex->unique = unique; skiplistIndex->unique = unique;
skiplistIndex->sparse = sparse; skiplistIndex->sparse = sparse;
skiplistIndex->skiplist = TRI_InitSkipList(CmpElmElm,CmpKeyElm,skiplistIndex, skiplistIndex->skiplist = TRI_InitSkipList(CmpElmElm, CmpKeyElm, skiplistIndex,
FreeElm,unique); FreeElm, unique);
if (skiplistIndex->skiplist == NULL) { if (skiplistIndex->skiplist == NULL) {
TRI_Free(TRI_CORE_MEM_ZONE, skiplistIndex); TRI_Free(TRI_CORE_MEM_ZONE, skiplistIndex);
return NULL; return NULL;

View File

@ -47,11 +47,6 @@ struct TRI_document_collection_s;
// --SECTION-- public types // --SECTION-- public types
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup VocBase
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief datafile attribute marker /// @brief datafile attribute marker
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -75,19 +70,10 @@ typedef struct TRI_df_shape_marker_s {
} }
TRI_df_shape_marker_t; TRI_df_shape_marker_t;
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup VocBase
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief creates a shaper /// @brief creates a shaper
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -107,19 +93,10 @@ void TRI_DestroyVocShaper (TRI_shaper_t*);
void TRI_FreeVocShaper (TRI_shaper_t*); void TRI_FreeVocShaper (TRI_shaper_t*);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public functions // --SECTION-- public functions
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup VocBase
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief destroys a shaper, but does not free the pointer /// @brief destroys a shaper, but does not free the pointer
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -182,10 +159,6 @@ int TRI_CompareShapeTypes (TRI_doc_mptr_t* leftDocument,
TRI_shaper_t* leftShaper, TRI_shaper_t* leftShaper,
TRI_shaper_t* rightShaper); TRI_shaper_t* rightShaper);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -505,6 +505,14 @@ TRI_shape_t* TRI_LookupBasicShapeShaper (TRI_shape_t const* shape) {
return NULL; return NULL;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the first id for user-defined shapes
////////////////////////////////////////////////////////////////////////////////
TRI_shape_sid_t TRI_FirstCustomShapeIdShaper () {
return 7;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief initialises global basic shape types /// @brief initialises global basic shape types
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -555,6 +563,8 @@ void TRI_InitialiseShaper () {
shape->_type = TRI_SHAPE_LIST; shape->_type = TRI_SHAPE_LIST;
shape->_dataSize = TRI_SHAPE_SIZE_VARIABLE; shape->_dataSize = TRI_SHAPE_SIZE_VARIABLE;
shape->_sid = BasicShapes._sidList = 6; shape->_sid = BasicShapes._sidList = 6;
assert(shape->_sid + 1 == TRI_FirstCustomShapeIdShaper());
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -165,6 +165,12 @@ TRI_shape_t* TRI_LookupSidBasicShapeShaper (TRI_shape_sid_t);
TRI_shape_t* TRI_LookupBasicShapeShaper (TRI_shape_t const*); TRI_shape_t* TRI_LookupBasicShapeShaper (TRI_shape_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the first id for user-defined shapes
////////////////////////////////////////////////////////////////////////////////
TRI_shape_sid_t TRI_FirstCustomShapeIdShaper (void);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief initialises global basic shape types /// @brief initialises global basic shape types
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////