From d5200f26d7bfbe8f02be33e8869e62b53a7cfb29 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Fri, 16 May 2014 19:05:54 +0200 Subject: [PATCH] moved magic number to function --- arangod/SkipLists/skiplistIndex.cpp | 4 ++-- arangod/VocBase/voc-shaper.h | 27 --------------------------- lib/ShapedJson/json-shaper.cpp | 10 ++++++++++ lib/ShapedJson/json-shaper.h | 6 ++++++ 4 files changed, 18 insertions(+), 29 deletions(-) diff --git a/arangod/SkipLists/skiplistIndex.cpp b/arangod/SkipLists/skiplistIndex.cpp index f09c92c034..9cf08e124a 100644 --- a/arangod/SkipLists/skiplistIndex.cpp +++ b/arangod/SkipLists/skiplistIndex.cpp @@ -536,8 +536,8 @@ SkiplistIndex* SkiplistIndex_new (TRI_primary_collection_t* primary, skiplistIndex->_numFields = numFields; skiplistIndex->unique = unique; skiplistIndex->sparse = sparse; - skiplistIndex->skiplist = TRI_InitSkipList(CmpElmElm,CmpKeyElm,skiplistIndex, - FreeElm,unique); + skiplistIndex->skiplist = TRI_InitSkipList(CmpElmElm, CmpKeyElm, skiplistIndex, + FreeElm, unique); if (skiplistIndex->skiplist == NULL) { TRI_Free(TRI_CORE_MEM_ZONE, skiplistIndex); return NULL; diff --git a/arangod/VocBase/voc-shaper.h b/arangod/VocBase/voc-shaper.h index af01d9f3c4..98d8a550ac 100644 --- a/arangod/VocBase/voc-shaper.h +++ b/arangod/VocBase/voc-shaper.h @@ -47,11 +47,6 @@ struct TRI_document_collection_s; // --SECTION-- public types // ----------------------------------------------------------------------------- -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup VocBase -/// @{ -//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @brief datafile attribute marker //////////////////////////////////////////////////////////////////////////////// @@ -75,19 +70,10 @@ typedef struct TRI_df_shape_marker_s { } TRI_df_shape_marker_t; -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- constructors and destructors // ----------------------------------------------------------------------------- -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup VocBase -/// @{ -//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @brief creates a shaper //////////////////////////////////////////////////////////////////////////////// @@ -107,19 +93,10 @@ void TRI_DestroyVocShaper (TRI_shaper_t*); void TRI_FreeVocShaper (TRI_shaper_t*); -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- public functions // ----------------------------------------------------------------------------- -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup VocBase -/// @{ -//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @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* rightShaper); -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - #ifdef __cplusplus } #endif diff --git a/lib/ShapedJson/json-shaper.cpp b/lib/ShapedJson/json-shaper.cpp index 66c4d0edf0..800bc081b9 100644 --- a/lib/ShapedJson/json-shaper.cpp +++ b/lib/ShapedJson/json-shaper.cpp @@ -505,6 +505,14 @@ TRI_shape_t* TRI_LookupBasicShapeShaper (TRI_shape_t const* shape) { 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 //////////////////////////////////////////////////////////////////////////////// @@ -555,6 +563,8 @@ void TRI_InitialiseShaper () { shape->_type = TRI_SHAPE_LIST; shape->_dataSize = TRI_SHAPE_SIZE_VARIABLE; shape->_sid = BasicShapes._sidList = 6; + + assert(shape->_sid + 1 == TRI_FirstCustomShapeIdShaper()); } //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/ShapedJson/json-shaper.h b/lib/ShapedJson/json-shaper.h index affa6f47f0..e95d98bd91 100644 --- a/lib/ShapedJson/json-shaper.h +++ b/lib/ShapedJson/json-shaper.h @@ -165,6 +165,12 @@ TRI_shape_t* TRI_LookupSidBasicShapeShaper (TRI_shape_sid_t); 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 ////////////////////////////////////////////////////////////////////////////////