From 412dc52109dad01068d29bcc3e4bac992113ba45 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Sun, 14 Oct 2012 21:35:41 +0200 Subject: [PATCH 01/28] fixed memory zone issues --- arangod/RestHandler/RestImportHandler.cpp | 2 +- arangod/RestHandler/RestVocbaseBaseHandler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arangod/RestHandler/RestImportHandler.cpp b/arangod/RestHandler/RestImportHandler.cpp index 965e6a9522..c2f4cde883 100644 --- a/arangod/RestHandler/RestImportHandler.cpp +++ b/arangod/RestHandler/RestImportHandler.cpp @@ -482,7 +482,7 @@ TRI_json_t* RestImportHandler::parseJsonLine (const string& line) { if (errmsg != 0) { // must free this error message, otherwise we'll have a memleak - TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, errmsg); + TRI_FreeString(TRI_CORE_MEM_ZONE, errmsg); } return json; } diff --git a/arangod/RestHandler/RestVocbaseBaseHandler.cpp b/arangod/RestHandler/RestVocbaseBaseHandler.cpp index edea765409..b633d528b6 100644 --- a/arangod/RestHandler/RestVocbaseBaseHandler.cpp +++ b/arangod/RestHandler/RestVocbaseBaseHandler.cpp @@ -546,7 +546,7 @@ TRI_json_t* RestVocbaseBaseHandler::parseJsonBody () { TRI_ERROR_HTTP_CORRUPTED_JSON, errmsg); - TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, errmsg); + TRI_FreeString(TRI_CORE_MEM_ZONE, errmsg); } return 0; From 9312c9e8f9c1670af24bd1697200009cee948901 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Sun, 14 Oct 2012 21:36:26 +0200 Subject: [PATCH 02/28] issue #240: add documentation about collection type --- .../api-collection-create-collection | 18 ++++++++++++++++++ js/actions/system/api-collection.js | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/Documentation/Examples.ArangoDB/api-collection-create-collection b/Documentation/Examples.ArangoDB/api-collection-create-collection index 920d122bb3..26c731e595 100644 --- a/Documentation/Examples.ArangoDB/api-collection-create-collection +++ b/Documentation/Examples.ArangoDB/api-collection-create-collection @@ -11,5 +11,23 @@ location: /_api/collection/179665369 "waitForSync": false, "id": 179665369, "status": 3, + "type" : 2, + "error": false +} + +> curl --data @- -X POST --dump - http://localhost:8529/_api/collection +{ "name" : "UnitTestsCollectionEdges", "type" : 3 } + +HTTP/1.1 200 OK +content-type: application/json +location: /_api/collection/184354432 + +{ + "name": "UnitTestsCollectionEdges", + "code": 200, + "waitForSync": false, + "id": 184354432, + "status": 3, + "type": 3, "error": false } diff --git a/js/actions/system/api-collection.js b/js/actions/system/api-collection.js index 635e421530..0991144efd 100644 --- a/js/actions/system/api-collection.js +++ b/js/actions/system/api-collection.js @@ -113,6 +113,11 @@ /// only. API implementors may be required to create system collections in /// very special occasions, but normally a regular collection will do. /// +/// - @LIT{type} (optional, default is @LIT{2}): the type of the collection to +/// create. The following values for @FA{type} are valid: +/// - @LIT{2}: document collections +/// - @LIT{3}: edge collection +/// /// @EXAMPLES /// /// @verbinclude api-collection-create-collection From 354d4573d4edfacc77a6a6295f1dfc3f77115970 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Sun, 14 Oct 2012 21:47:55 +0200 Subject: [PATCH 03/28] fixed some memory issues in hashindex --- arangod/HashIndex/hasharray.c | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/arangod/HashIndex/hasharray.c b/arangod/HashIndex/hasharray.c index 6e1da82a9e..90274b5b40 100755 --- a/arangod/HashIndex/hasharray.c +++ b/arangod/HashIndex/hasharray.c @@ -132,9 +132,6 @@ bool TRI_InitHashArray (TRI_hasharray_t* array, //////////////////////////////////////////////////////////////////////////////// void TRI_DestroyHashArray (TRI_hasharray_t* array) { - char* p; - char* e; - if (array == NULL) { return; } @@ -144,12 +141,19 @@ void TRI_DestroyHashArray (TRI_hasharray_t* array) { // Go through each item in the array and remove any internal allocated memory // ........................................................................... - p = array->_table; - e = p + array->_elementSize * array->_nrAlloc; - for (; p < e; p += array->_elementSize) { - IndexStaticDestroyElement(array, p); + // array->_table might be NULL if array initialisation fails + if (array->_table != NULL) { + char* p; + char* e; + + p = array->_table; + e = p + array->_elementSize * array->_nrAlloc; + for (; p < e; p += array->_elementSize) { + IndexStaticDestroyElement(array, p); + } + + TRI_Free(TRI_UNKNOWN_MEM_ZONE, array->_table); } - TRI_Free(TRI_UNKNOWN_MEM_ZONE, array->_table); } @@ -1084,7 +1088,6 @@ bool TRI_RemoveKeyHashArrayMulti (TRI_hasharray_t* array, void* key) { /// @} //////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- forward declared private functions // ----------------------------------------------------------------------------- @@ -1094,7 +1097,6 @@ bool TRI_RemoveKeyHashArrayMulti (TRI_hasharray_t* array, void* key) { /// @{ //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @brief adds a new element //////////////////////////////////////////////////////////////////////////////// @@ -1109,7 +1111,6 @@ static void AddNewElement (TRI_hasharray_t* array, void* element) { hash = IndexStaticHashElement(array, element); - // ........................................................................... // search the table // ........................................................................... @@ -1121,7 +1122,6 @@ static void AddNewElement (TRI_hasharray_t* array, void* element) { array->_nrProbesR++; } - // ........................................................................... // add a new element to the associative array // memcpy ok here since are simply moving array items internally @@ -1131,7 +1131,6 @@ static void AddNewElement (TRI_hasharray_t* array, void* element) { array->_nrUsed++; } - //////////////////////////////////////////////////////////////////////////////// /// @brief resizes the array //////////////////////////////////////////////////////////////////////////////// @@ -1145,14 +1144,18 @@ static bool ResizeHashArray (TRI_hasharray_t* array) { oldAlloc = array->_nrAlloc; array->_nrAlloc = 2 * array->_nrAlloc + 1; - array->_nrUsed = 0; - array->_nrResizes++; array->_table = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, array->_nrAlloc * array->_elementSize, true); if (array->_table == NULL) { + // allocation has failed. must restore original values array->_table = oldTable; + array->_nrAlloc = oldAlloc; + return false; - } + } + + array->_nrUsed = 0; + array->_nrResizes++; for (j = 0; j < array->_nrAlloc; j++) { IndexStaticClearElement(array, array->_table + j * array->_elementSize); @@ -1182,15 +1185,19 @@ static bool ResizeHashArrayMulti (TRI_hasharray_t* array) { oldAlloc = array->_nrAlloc; array->_nrAlloc = 2 * array->_nrAlloc + 1; - array->_nrUsed = 0; - array->_nrResizes++; array->_table = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, array->_nrAlloc * array->_elementSize, true); if (array->_table == NULL) { + // allocation has failed, must restore original values array->_table = oldTable; + array->_nrAlloc = oldAlloc; + return false; } + array->_nrUsed = 0; + array->_nrResizes++; + for (j = 0; j < array->_nrAlloc; j++) { IndexStaticClearElement(array, array->_table + j * array->_elementSize); } @@ -1205,17 +1212,10 @@ static bool ResizeHashArrayMulti (TRI_hasharray_t* array) { return true; } - //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// - - - - - - // Local Variables: // mode: outline-minor // outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)" From 7e0c2bb4ad1005404cd45972c066fbded820d0ff Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Sun, 14 Oct 2012 21:57:20 +0200 Subject: [PATCH 04/28] fixed documentation --- arangod/V8Server/v8-vocbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 4da22ea3ba..0bd6405752 100755 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -4644,7 +4644,7 @@ static v8::Handle JS_CompletionsVocBase (v8::Arguments const& argv) { /// for @LIT{waitForSync} is @LIT{false}. /// /// The type of the collection is automatically determined by the object that -/// @FA(_create) is invoked with: +/// @FA{_create} is invoked with: /// - if invoked on @LIT{db}, a document collection will be created /// - if invoked on @LIT{edges}, an edge collection will be created /// From 26f130eb47fd0770e1f88a00b2a2e78cb1542672 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Sun, 14 Oct 2012 22:08:26 +0200 Subject: [PATCH 05/28] fixed action documentation --- arangod/Documentation/module-actions.dox | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arangod/Documentation/module-actions.dox b/arangod/Documentation/module-actions.dox index 721fffb329..5353b9e13f 100644 --- a/arangod/Documentation/module-actions.dox +++ b/arangod/Documentation/module-actions.dox @@ -67,49 +67,49 @@ ///////////////////////////////////////// /// /// @anchor JSModuleActionsDefineHttp -/// @copydetails JSF_DefineHttp +/// @copydetails JSF_defineHttp ///
/// /// @anchor JSModuleActionsResultError -/// @copydetails JSF_ResultError +/// @copydetails JSF_resultError ///
/// /// @anchor JSModuleActionsGetErrorMessage -/// @copydetails JSF_GetErrorMessage +/// @copydetails JSF_getErrorMessage ///
/// /// @section JSModuleActionsHTTP Standard HTTP Result Generators //////////////////////////////////////////////////////////////// /// /// @anchor JSModuleActionsResultOk -/// @copydetails JSF_ResultOk +/// @copydetails JSF_resultOk ///
/// /// @anchor JSModuleActionsResultBad -/// @copydetails JSF_ResultBad +/// @copydetails JSF_resultBad ///
/// /// @anchor JSModuleActionsResultNotFound -/// @copydetails JSF_ResultNotFound +/// @copydetails JSF_resultNotFound ///
/// /// @anchor JSModuleActionsResultUnsupported -/// @copydetails JSF_ResultUnsupported +/// @copydetails JSF_resultUnsupported ///
/// /// @section JSModuleActionsArangoDB ArangoDB Result Generators ///////////////////////////////////////////////////////////////// /// /// @anchor JSModuleActionsCollectionNotFound -/// @copydetails JSF_CollectionNotFound +/// @copydetails JSF_collectionNotFound ///
/// /// @anchor JSModuleActionsIndexNotFound -/// @copydetails JSF_IndexNotFound +/// @copydetails JSF_indexNotFound ///
/// /// @anchor JSModuleActionsResultException -/// @copydetails JSF_ResultException +/// @copydetails JSF_resultException //////////////////////////////////////////////////////////////////////////////// // Local Variables: From fa5a45f7aada3aee1be05d072b3fd9d5ec5d2f3e Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Sun, 14 Oct 2012 22:09:51 +0200 Subject: [PATCH 06/28] added TAGS file again --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0b28df562c..6d65e72f12 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ autom4te.cache build.h config.log config.status +TAGS Doxygen/*.doxy Doxygen/html/ From ea4dd1c17ff6eaf600ca624bd6018e2ed736091f Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Sun, 14 Oct 2012 22:10:58 +0200 Subject: [PATCH 07/28] consider 32bit files --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 6d65e72f12..80510a3129 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,10 @@ js-*.h .v8-build-64 .icu-build-64 .mruby-build-64 +.libev-build-32 +.v8-build-32 +.icu-build-32 +.mruby-build-32 .setup-mr-directories .setup-js-directories From bf3d14eb148a043d4b035f55ffe5c397938fd265 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 09:36:50 +0200 Subject: [PATCH 08/28] changed gitignore, added derived files --- .gitignore | 10 + arangod/Ahuacatl/ahuacatl-grammar.c | 864 +++++++++++++--------------- arangod/Ahuacatl/ahuacatl-grammar.h | 14 +- arangod/Ahuacatl/ahuacatl-tokens.c | 48 +- lib/JsonParser/json-parser.c | 44 +- lib/V8/v8-json.cpp | 44 +- 6 files changed, 489 insertions(+), 535 deletions(-) diff --git a/.gitignore b/.gitignore index 80510a3129..66a73d9975 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,13 @@ js-*.h .mruby-build-32 .setup-mr-directories .setup-js-directories +3rdParty/libev/ARCH.x64/ +3rdParty/libev/ARCH.IA32/ + +Doxygen/doc/ +Doxygen/manuals/ +Doxygen/wiki/ +Doxygen/xml/ README Makefile @@ -23,6 +30,9 @@ autom4te.cache build.h config.log config.status +config/compile +config/install-sh +config/missing TAGS Doxygen/*.doxy diff --git a/arangod/Ahuacatl/ahuacatl-grammar.c b/arangod/Ahuacatl/ahuacatl-grammar.c index 4e81bd8d00..f8f036f7ca 100644 --- a/arangod/Ahuacatl/ahuacatl-grammar.c +++ b/arangod/Ahuacatl/ahuacatl-grammar.c @@ -1,8 +1,10 @@ -/* A Bison parser, made by GNU Bison 2.5. */ -/* Bison implementation for Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -73,7 +75,7 @@ /* Copy the first part of user declarations. */ -/* Line 268 of yacc.c */ +/* Line 189 of yacc.c */ #line 10 "arangod/Ahuacatl/ahuacatl-grammar.y" #include @@ -91,8 +93,8 @@ #include "Ahuacatl/ahuacatl-scope.h" -/* Line 268 of yacc.c */ -#line 96 "arangod/Ahuacatl/ahuacatl-grammar.c" +/* Line 189 of yacc.c */ +#line 98 "arangod/Ahuacatl/ahuacatl-grammar.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -177,7 +179,7 @@ typedef union YYSTYPE { -/* Line 301 of yacc.c */ +/* Line 214 of yacc.c */ #line 26 "arangod/Ahuacatl/ahuacatl-grammar.y" TRI_aql_node_t* node; @@ -187,8 +189,8 @@ typedef union YYSTYPE -/* Line 301 of yacc.c */ -#line 192 "arangod/Ahuacatl/ahuacatl-grammar.c" +/* Line 214 of yacc.c */ +#line 194 "arangod/Ahuacatl/ahuacatl-grammar.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -211,7 +213,7 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 343 of yacc.c */ +/* Line 264 of yacc.c */ #line 33 "arangod/Ahuacatl/ahuacatl-grammar.y" @@ -241,8 +243,8 @@ void Ahuacatlerror (YYLTYPE* locp, TRI_aql_context_t* const context, const char* -/* Line 343 of yacc.c */ -#line 246 "arangod/Ahuacatl/ahuacatl-grammar.c" +/* Line 264 of yacc.c */ +#line 248 "arangod/Ahuacatl/ahuacatl-grammar.c" #ifdef short # undef short @@ -292,7 +294,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -345,11 +347,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +# ifndef _STDLIB_H +# define _STDLIB_H 1 # endif # endif # endif @@ -372,24 +374,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ +# if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +# ifndef _STDLIB_H +# define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -420,7 +422,23 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) -# define YYCOPY_NEEDED 1 +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -440,26 +458,6 @@ union yyalloc #endif -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ @@ -667,8 +665,8 @@ static const yytype_uint8 yyr2[] = 1, 1, 2 }; -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -737,7 +735,8 @@ static const yytype_int8 yypgoto[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -82 static const yytype_int16 yytable[] = { @@ -775,12 +774,6 @@ static const yytype_int16 yytable[] = 75, 76 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-41)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - static const yytype_int16 yycheck[] = { 6, 7, 4, 5, 44, 44, 44, 19, 33, 34, @@ -852,18 +845,9 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ + Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -873,6 +857,7 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -919,7 +904,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1128,6 +1113,7 @@ int yydebug; # define YYMAXDEPTH 10000 #endif + #if YYERROR_VERBOSE @@ -1230,142 +1216,115 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = 0; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; + int yyn = yypact[yystate]; - /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; } #endif /* YYERROR_VERBOSE */ + /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1402,7 +1361,6 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context) } } - /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus @@ -1419,9 +1377,12 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ -/*----------. -| yyparse. | -`----------*/ + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1485,7 +1446,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3]; + YYLTYPE yyerror_range[2]; YYSIZE_T yystacksize; @@ -1532,7 +1493,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +#if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -1634,7 +1595,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) + if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1665,8 +1626,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yytable_value_is_error (yyn)) - goto yyerrlab; + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1722,79 +1683,79 @@ yyreduce: { case 2: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 176 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 3: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 181 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 4: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 183 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 5: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 188 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 6: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 190 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 7: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 192 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 8: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 194 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 9: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 196 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 10: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 198 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 11: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 203 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node; @@ -1811,12 +1772,12 @@ yyreduce: if (!TRI_AddStatementListAql(context->_statements, node)) { ABORT_OOM } - } + ;} break; case 12: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 222 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeFilterAql(context, (yyvsp[(2) - (2)].node)); @@ -1827,12 +1788,12 @@ yyreduce: if (!TRI_AddStatementListAql(context->_statements, node)) { ABORT_OOM } - } + ;} break; case 13: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 235 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeLetAql(context, (yyvsp[(2) - (4)].strval), (yyvsp[(4) - (4)].node)); @@ -1843,12 +1804,12 @@ yyreduce: if (!TRI_AddStatementListAql(context->_statements, node)) { ABORT_OOM } - } + ;} break; case 14: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 248 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeListAql(context); @@ -1858,12 +1819,12 @@ yyreduce: } TRI_PushStackParseAql(context, node); - } + ;} break; case 15: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 256 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeCollectAql(context, TRI_PopStackParseAql(context), (yyvsp[(4) - (4)].strval)); @@ -1874,28 +1835,28 @@ yyreduce: if (!TRI_AddStatementListAql(context->_statements, node)) { ABORT_OOM } - } + ;} break; case 16: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 269 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 17: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 271 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 18: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 276 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeAssignAql(context, (yyvsp[(1) - (3)].strval), (yyvsp[(3) - (3)].node)); @@ -1906,30 +1867,30 @@ yyreduce: if (!TRI_PushListAql(context, node)) { ABORT_OOM } - } + ;} break; case 19: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 289 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.strval) = NULL; - } + ;} break; case 20: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 292 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.strval) = (yyvsp[(2) - (2)].strval); - } + ;} break; case 21: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 298 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeListAql(context); @@ -1939,12 +1900,12 @@ yyreduce: } TRI_PushStackParseAql(context, node); - } + ;} break; case 22: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 306 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* list = TRI_PopStackParseAql(context); @@ -1956,34 +1917,34 @@ yyreduce: if (!TRI_AddStatementListAql(context->_statements, node)) { ABORT_OOM } - } + ;} break; case 23: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 320 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!TRI_PushListAql(context, (yyvsp[(1) - (1)].node))) { ABORT_OOM } - } + ;} break; case 24: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 325 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!TRI_PushListAql(context, (yyvsp[(3) - (3)].node))) { ABORT_OOM } - } + ;} break; case 25: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 333 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeSortElementAql(context, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].boolval)); @@ -1992,39 +1953,39 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 26: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 344 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.boolval) = true; - } + ;} break; case 27: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 347 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.boolval) = true; - } + ;} break; case 28: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 350 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.boolval) = false; - } + ;} break; case 29: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 356 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, TRI_CreateNodeValueIntAql(context, 0), TRI_CreateNodeValueIntAql(context, (yyvsp[(2) - (2)].intval))); @@ -2039,12 +2000,12 @@ yyreduce: if (!TRI_AddStatementListAql(context->_statements, node)) { ABORT_OOM } - } + ;} break; case 30: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 370 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, TRI_CreateNodeValueIntAql(context, (yyvsp[(2) - (4)].intval)), TRI_CreateNodeValueIntAql(context, (yyvsp[(4) - (4)].intval))); @@ -2055,12 +2016,12 @@ yyreduce: if (!TRI_AddStatementListAql(context->_statements, node)) { ABORT_OOM } - } + ;} break; case 31: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 383 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeReturnAql(context, (yyvsp[(2) - (2)].node)); @@ -2077,33 +2038,33 @@ yyreduce: } // $$ = node; - } + ;} break; case 32: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 403 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(2) - (3)].node); - } + ;} break; case 33: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 406 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!TRI_StartScopeAql(context, TRI_AQL_SCOPE_SUBQUERY)) { ABORT_OOM } - } + ;} break; case 34: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 411 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* result; @@ -2135,39 +2096,39 @@ yyreduce: // return the result (yyval.node) = result; - } + ;} break; case 35: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 442 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 36: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 445 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 37: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 448 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 38: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 451 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node; @@ -2182,12 +2143,12 @@ yyreduce: } TRI_PushStackParseAql(context, node); - } + ;} break; case 39: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 464 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* list = TRI_PopStackParseAql(context); @@ -2197,39 +2158,39 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 40: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 473 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 41: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 476 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 42: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 479 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 43: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 485 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryPlusAql(context, (yyvsp[(2) - (2)].node)); @@ -2238,12 +2199,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 44: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 493 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryMinusAql(context, (yyvsp[(2) - (2)].node)); @@ -2252,12 +2213,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 45: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 501 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryNotAql(context, (yyvsp[(2) - (2)].node)); @@ -2266,12 +2227,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 46: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 512 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryOrAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2280,12 +2241,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 47: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 520 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryAndAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2294,12 +2255,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 48: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 528 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryPlusAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2308,12 +2269,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 49: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 536 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryMinusAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2322,12 +2283,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 50: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 544 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryTimesAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2336,12 +2297,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 51: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 552 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryDivAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2350,12 +2311,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 52: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 560 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryModAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2364,12 +2325,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 53: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 568 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryEqAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2378,12 +2339,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 54: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 576 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryNeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2392,12 +2353,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 55: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 584 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryLtAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2406,12 +2367,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 56: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 592 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryGtAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2420,12 +2381,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 57: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 600 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryLeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2434,12 +2395,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 58: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 608 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryGeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2448,12 +2409,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 59: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 616 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryInAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -2462,12 +2423,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 60: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 627 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorTernaryAql(context, (yyvsp[(1) - (5)].node), (yyvsp[(3) - (5)].node), (yyvsp[(5) - (5)].node)); @@ -2476,64 +2437,64 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 61: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 638 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 62: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 640 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 63: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 645 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_PushListAql(context, (yyvsp[(1) - (1)].node)); - } + ;} break; case 64: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 648 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_PushListAql(context, (yyvsp[(3) - (3)].node)); - } + ;} break; case 65: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 654 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 66: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 657 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 67: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 663 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeListAql(context); @@ -2542,59 +2503,59 @@ yyreduce: } TRI_PushStackParseAql(context, node); - } + ;} break; case 68: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 670 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = TRI_PopStackParseAql(context); - } + ;} break; case 69: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 676 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 70: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 678 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 71: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 683 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!TRI_PushListAql(context, (yyvsp[(1) - (1)].node))) { ABORT_OOM } - } + ;} break; case 72: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 688 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!TRI_PushListAql(context, (yyvsp[(3) - (3)].node))) { ABORT_OOM } - } + ;} break; case 73: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 696 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeArrayAql(context); @@ -2603,74 +2564,74 @@ yyreduce: } TRI_PushStackParseAql(context, node); - } + ;} break; case 74: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 703 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = TRI_PopStackParseAql(context); - } + ;} break; case 75: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 709 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 76: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 711 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 77: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 716 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 78: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 718 "arangod/Ahuacatl/ahuacatl-grammar.y" { - } + ;} break; case 79: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 723 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!TRI_PushArrayAql(context, (yyvsp[(1) - (3)].strval), (yyvsp[(3) - (3)].node))) { ABORT_OOM } - } + ;} break; case 80: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 732 "arangod/Ahuacatl/ahuacatl-grammar.y" { // start of reference (collection or variable name) (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 81: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 736 "arangod/Ahuacatl/ahuacatl-grammar.y" { // expanded variable access, e.g. variable[*] @@ -2696,12 +2657,12 @@ yyreduce: // push the variable TRI_PushStackParseAql(context, node); - } + ;} break; case 82: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 760 "arangod/Ahuacatl/ahuacatl-grammar.y" { // return from the "expansion" subrule @@ -2728,12 +2689,12 @@ yyreduce: if (!(yyval.node)) { ABORT_OOM } - } + ;} break; case 83: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 789 "arangod/Ahuacatl/ahuacatl-grammar.y" { // variable or collection @@ -2751,12 +2712,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 84: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 806 "arangod/Ahuacatl/ahuacatl-grammar.y" { // named variable access, e.g. variable.reference @@ -2765,12 +2726,12 @@ yyreduce: if (!(yyval.node)) { ABORT_OOM } - } + ;} break; case 85: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 814 "arangod/Ahuacatl/ahuacatl-grammar.y" { // indexed variable access, e.g. variable[index] @@ -2779,12 +2740,12 @@ yyreduce: if (!(yyval.node)) { ABORT_OOM } - } + ;} break; case 86: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 825 "arangod/Ahuacatl/ahuacatl-grammar.y" { // named variable access, continuation from * expansion, e.g. [*].variable.reference @@ -2795,12 +2756,12 @@ yyreduce: if (!(yyval.node)) { ABORT_OOM } - } + ;} break; case 87: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 835 "arangod/Ahuacatl/ahuacatl-grammar.y" { // indexed variable access, continuation from * expansion, e.g. [*].variable[index] @@ -2811,12 +2772,12 @@ yyreduce: if (!(yyval.node)) { ABORT_OOM } - } + ;} break; case 88: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 845 "arangod/Ahuacatl/ahuacatl-grammar.y" { // named variable access, continuation from * expansion, e.g. [*].variable.xx.reference @@ -2824,12 +2785,12 @@ yyreduce: if (!(yyval.node)) { ABORT_OOM } - } + ;} break; case 89: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 852 "arangod/Ahuacatl/ahuacatl-grammar.y" { // indexed variable access, continuation from * expansion, e.g. [*].variable.xx.[index] @@ -2837,30 +2798,30 @@ yyreduce: if (!(yyval.node)) { ABORT_OOM } - } + ;} break; case 90: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 862 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 91: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 865 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.node) = (yyvsp[(1) - (1)].node); - } + ;} break; case 92: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 871 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeValueStringAql(context, (yyvsp[(1) - (1)].strval)); @@ -2869,12 +2830,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 93: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 879 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node; @@ -2889,12 +2850,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 94: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 893 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeValueNullAql(context); @@ -2903,12 +2864,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 95: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 901 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, true); @@ -2917,12 +2878,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 96: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 909 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, false); @@ -2931,12 +2892,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 97: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 920 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeParameterAql(context, (yyvsp[(1) - (1)].strval)); @@ -2945,12 +2906,12 @@ yyreduce: } (yyval.node) = node; - } + ;} break; case 98: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 931 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!(yyvsp[(1) - (1)].strval)) { @@ -2958,12 +2919,12 @@ yyreduce: } (yyval.strval) = (yyvsp[(1) - (1)].strval); - } + ;} break; case 99: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 938 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!(yyvsp[(1) - (1)].strval)) { @@ -2971,21 +2932,21 @@ yyreduce: } (yyval.strval) = (yyvsp[(1) - (1)].strval); - } + ;} break; case 100: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 947 "arangod/Ahuacatl/ahuacatl-grammar.y" { (yyval.strval) = (yyvsp[(1) - (1)].strval); - } + ;} break; case 101: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 953 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!(yyvsp[(1) - (1)].strval)) { @@ -2993,12 +2954,12 @@ yyreduce: } (yyval.intval) = TRI_Int64String((yyvsp[(1) - (1)].strval)); - } + ;} break; case 102: -/* Line 1821 of yacc.c */ +/* Line 1455 of yacc.c */ #line 960 "arangod/Ahuacatl/ahuacatl-grammar.y" { if (!(yyvsp[(2) - (2)].strval)) { @@ -3006,26 +2967,15 @@ yyreduce: } (yyval.intval) = - TRI_Int64String((yyvsp[(2) - (2)].strval)); - } + ;} break; -/* Line 1821 of yacc.c */ -#line 3016 "arangod/Ahuacatl/ahuacatl-grammar.c" +/* Line 1455 of yacc.c */ +#line 2977 "arangod/Ahuacatl/ahuacatl-grammar.c" default: break; } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -3054,10 +3004,6 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -3065,40 +3011,41 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (&yylloc, context, YY_("syntax error")); #else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (&yylloc, context, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (&yylloc, context, yymsg); + } + else + { + yyerror (&yylloc, context, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } } -# undef YYSYNTAX_ERROR #endif } - yyerror_range[1] = yylloc; + yyerror_range[0] = yylloc; if (yyerrstatus == 3) { @@ -3135,7 +3082,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[1] = yylsp[1-yylen]; + yyerror_range[0] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -3154,7 +3101,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) + if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -3169,7 +3116,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[1] = *yylsp; + yyerror_range[0] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, context); YYPOPSTACK (1); @@ -3179,10 +3126,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[2] = yylloc; + yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; /* Shift the error token. */ @@ -3218,13 +3165,8 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc, context); - } + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, context); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); diff --git a/arangod/Ahuacatl/ahuacatl-grammar.h b/arangod/Ahuacatl/ahuacatl-grammar.h index cd0c7a1280..a47c8c24d2 100644 --- a/arangod/Ahuacatl/ahuacatl-grammar.h +++ b/arangod/Ahuacatl/ahuacatl-grammar.h @@ -1,8 +1,10 @@ -/* A Bison parser, made by GNU Bison 2.5. */ -/* Bison interface for Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -95,7 +97,7 @@ typedef union YYSTYPE { -/* Line 2132 of yacc.c */ +/* Line 1676 of yacc.c */ #line 26 "arangod/Ahuacatl/ahuacatl-grammar.y" TRI_aql_node_t* node; @@ -105,8 +107,8 @@ typedef union YYSTYPE -/* Line 2132 of yacc.c */ -#line 110 "arangod/Ahuacatl/ahuacatl-grammar.h" +/* Line 1676 of yacc.c */ +#line 112 "arangod/Ahuacatl/ahuacatl-grammar.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/arangod/Ahuacatl/ahuacatl-tokens.c b/arangod/Ahuacatl/ahuacatl-tokens.c index f14d639f07..e5da74e95f 100644 --- a/arangod/Ahuacatl/ahuacatl-tokens.c +++ b/arangod/Ahuacatl/ahuacatl-tokens.c @@ -46,7 +46,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -170,11 +169,6 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 @@ -188,7 +182,7 @@ typedef size_t yy_size_t; */ #define YY_LESS_LINENO(n) \ do { \ - yy_size_t yyl;\ + int yyl;\ for ( yyl = n; yyl < yyleng; ++yyl )\ if ( yytext[yyl] == '\n' )\ --yylineno;\ @@ -210,6 +204,11 @@ typedef size_t yy_size_t; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -227,7 +226,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -306,7 +305,7 @@ static void Ahuacatl_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscann YY_BUFFER_STATE Ahuacatl_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE Ahuacatl_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE Ahuacatl_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE Ahuacatl_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *Ahuacatlalloc (yy_size_t ,yyscan_t yyscanner ); void *Ahuacatlrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -357,7 +356,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (size_t) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; @@ -629,8 +628,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -687,7 +686,7 @@ FILE *Ahuacatlget_out (yyscan_t yyscanner ); void Ahuacatlset_out (FILE * out_str ,yyscan_t yyscanner ); -yy_size_t Ahuacatlget_leng (yyscan_t yyscanner ); +int Ahuacatlget_leng (yyscan_t yyscanner ); char *Ahuacatlget_text (yyscan_t yyscanner ); @@ -754,7 +753,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -915,7 +914,7 @@ yy_find_action: if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - yy_size_t yyl; + int yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) @@ -1483,7 +1482,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1497,7 +1496,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1528,7 +1527,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); + yyg->yy_n_chars, (int) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -1653,7 +1652,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1677,7 +1676,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) case EOB_ACT_END_OF_FILE: { if ( Ahuacatlwrap(yyscanner ) ) - return 0; + return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -1946,7 +1945,7 @@ void Ahuacatlpop_buffer_state (yyscan_t yyscanner) */ static void Ahuacatlensure_buffer_stack (yyscan_t yyscanner) { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -2044,11 +2043,12 @@ YY_BUFFER_STATE Ahuacatl_scan_string (yyconst char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE Ahuacatl_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE Ahuacatl_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2158,7 +2158,7 @@ FILE *Ahuacatlget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t Ahuacatlget_leng (yyscan_t yyscanner) +int Ahuacatlget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; diff --git a/lib/JsonParser/json-parser.c b/lib/JsonParser/json-parser.c index bd5694fe51..d5fd779efd 100644 --- a/lib/JsonParser/json-parser.c +++ b/lib/JsonParser/json-parser.c @@ -89,7 +89,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -213,11 +212,6 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 @@ -240,6 +234,11 @@ typedef size_t yy_size_t; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -257,7 +256,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -336,7 +335,7 @@ static void tri_jsp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscann YY_BUFFER_STATE tri_jsp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE tri_jsp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE tri_jsp__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE tri_jsp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *tri_jsp_alloc (yy_size_t ,yyscan_t yyscanner ); void *tri_jsp_realloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -387,7 +386,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (size_t) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; @@ -566,8 +565,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -614,7 +613,7 @@ FILE *tri_jsp_get_out (yyscan_t yyscanner ); void tri_jsp_set_out (FILE * out_str ,yyscan_t yyscanner ); -yy_size_t tri_jsp_get_leng (yyscan_t yyscanner ); +int tri_jsp_get_leng (yyscan_t yyscanner ); char *tri_jsp_get_text (yyscan_t yyscanner ); @@ -673,7 +672,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1129,7 +1128,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1143,7 +1142,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1174,7 +1173,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); + yyg->yy_n_chars, (int) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -1299,7 +1298,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1323,7 +1322,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) case EOB_ACT_END_OF_FILE: { if ( tri_jsp_wrap(yyscanner ) ) - return 0; + return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -1585,7 +1584,7 @@ void tri_jsp_pop_buffer_state (yyscan_t yyscanner) */ static void tri_jsp_ensure_buffer_stack (yyscan_t yyscanner) { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -1683,11 +1682,12 @@ YY_BUFFER_STATE tri_jsp__scan_string (yyconst char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE tri_jsp__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE tri_jsp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -1797,7 +1797,7 @@ FILE *tri_jsp_get_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t tri_jsp_get_leng (yyscan_t yyscanner) +int tri_jsp_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; diff --git a/lib/V8/v8-json.cpp b/lib/V8/v8-json.cpp index f5a3fb2440..192e2fc2ab 100644 --- a/lib/V8/v8-json.cpp +++ b/lib/V8/v8-json.cpp @@ -84,7 +84,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -208,11 +207,6 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 @@ -235,6 +229,11 @@ typedef size_t yy_size_t; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -252,7 +251,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -331,7 +330,7 @@ static void tri_v8__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanne YY_BUFFER_STATE tri_v8__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE tri_v8__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE tri_v8__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE tri_v8__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *tri_v8_alloc (yy_size_t ,yyscan_t yyscanner ); void *tri_v8_realloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -382,7 +381,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (size_t) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; @@ -554,8 +553,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -602,7 +601,7 @@ FILE *tri_v8_get_out (yyscan_t yyscanner ); void tri_v8_set_out (FILE * out_str ,yyscan_t yyscanner ); -yy_size_t tri_v8_get_leng (yyscan_t yyscanner ); +int tri_v8_get_leng (yyscan_t yyscanner ); char *tri_v8_get_text (yyscan_t yyscanner ); @@ -661,7 +660,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1108,7 +1107,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1122,7 +1121,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1153,7 +1152,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); + yyg->yy_n_chars, (int) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -1278,7 +1277,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1302,7 +1301,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) case EOB_ACT_END_OF_FILE: { if ( tri_v8_wrap(yyscanner ) ) - return 0; + return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -1562,7 +1561,7 @@ void tri_v8_pop_buffer_state (yyscan_t yyscanner) */ static void tri_v8_ensure_buffer_stack (yyscan_t yyscanner) { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -1660,11 +1659,12 @@ YY_BUFFER_STATE tri_v8__scan_string (yyconst char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE tri_v8__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE tri_v8__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -1774,7 +1774,7 @@ FILE *tri_v8_get_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t tri_v8_get_leng (yyscan_t yyscanner) +int tri_v8_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; From 589a7127390adee881f65db0d7d4635992a960b1 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 10:13:11 +0200 Subject: [PATCH 09/28] exclude more files --- .gitignore | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 66a73d9975..f57783fb65 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ js-*.h +mr-*.h .deps .dirstamp *.o @@ -28,11 +29,18 @@ Makefile.in aclocal.m4 autom4te.cache build.h +config/* config.log config.status config/compile +config/config.guess +config/config.h +config/config.sub config/install-sh +config/depcomp config/missing +config/stamp-h1 +configure TAGS Doxygen/*.doxy @@ -48,12 +56,6 @@ arangod/Ahuacatl/ahuacatl-grammar.h arangod/Ahuacatl/ahuacatl-grammar.output arangod/Ahuacatl/ahuacatl-tokens.c bin/ -config/config.guess -config/config.h -config/config.sub -config/depcomp -config/stamp-h1 -configure etc/arangodb/arangod.conf etc/arangodb/arangoirb.conf etc/arangodb/arangosh.conf From db7d1ec6be3af0df0f3afb4c2263d4d5dfa7f6f2 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 10:14:06 +0200 Subject: [PATCH 10/28] issue #241 --- 3rdParty/Makefile.all-in-one-icu | 2 +- Makefile.files | 4 ++++ m4/all-in-one.icu | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/3rdParty/Makefile.all-in-one-icu b/3rdParty/Makefile.all-in-one-icu index f697f9c37f..92a563fd58 100644 --- a/3rdParty/Makefile.all-in-one-icu +++ b/3rdParty/Makefile.all-in-one-icu @@ -8,7 +8,7 @@ ### @brief ICU ################################################################################ -BUILT_SOURCES += @ICU_LIBS@ +BUILT_SOURCES += @ICU_BUILT@ ICUDIR = @abs_top_srcdir@/3rdParty/icu/BUILD CLEANUP += @srcdir@/.icu-build-@TRI_BITS@ $(ICUDIR) diff --git a/Makefile.files b/Makefile.files index 650fae97a0..f7228c0751 100644 --- a/Makefile.files +++ b/Makefile.files @@ -37,12 +37,16 @@ BUILT_SOURCES += $(JAVASCRIPT_BROWSER) ### @brief MRuby source code as header ################################################################################ +if ENABLE_MRUBY + MRUBY_HEADER = \ mr/common/bootstrap/mr-error.h \ mr/server/mr-server.h BUILT_SOURCES += $(MRUBY_HEADER) +endif + ## ----------------------------------------------------------------------------- ## --SECTION-- END-OF-FILE ## ----------------------------------------------------------------------------- diff --git a/m4/all-in-one.icu b/m4/all-in-one.icu index f2c19f0ef0..89c493ef2d 100644 --- a/m4/all-in-one.icu +++ b/m4/all-in-one.icu @@ -13,6 +13,7 @@ dnl --- ICU_LIBS was: " -lpthread -ldl -lm ${icu_lib_dir}/libicui18n.a ${icu_lib ICU_CPPFLAGS="-D_REENTRANT -I${icu_build_dir}/include" ICU_LDFLAGS="" ICU_LIBS=" -ldl -lm ${icu_lib_dir}/libicui18n.a ${icu_lib_dir}/libicuuc.a ${icu_lib_dir}/libicudata.a -ldl -lm " +ICU_BUILT="${icu_lib_dir}/libicui18n.a ${icu_lib_dir}/libicuuc.a ${icu_lib_dir}/libicudata.a " TRI_ICU_VERSION="49.1.2" @@ -23,6 +24,7 @@ dnl ---------------------------------------------------------------------------- AC_SUBST(ICU_CPPFLAGS) AC_SUBST(ICU_LDFLAGS) AC_SUBST(ICU_LIBS) +AC_SUBST(ICU_BUILT) ICU_CPPFLAGS="${ICU_CPPFLAGS} -DTRI_ICU_VERSION='\"${TRI_ICU_VERSION}\"' -DTRI_HAVE_ICU=1" From 9547a5fb008cef5893cb424143091e5d52f5022a Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 10:16:32 +0200 Subject: [PATCH 11/28] current version --- config/compile | 227 +++------------------------------------------- config/install-sh | 35 +++---- config/missing | 148 +++++++++++++++++++----------- 3 files changed, 125 insertions(+), 285 deletions(-) diff --git a/config/compile b/config/compile index 7b4a9a7e1e..c0096a7b56 100755 --- a/config/compile +++ b/config/compile @@ -1,9 +1,10 @@ #! /bin/sh -# Wrapper for compilers which do not understand '-c -o'. +# Wrapper for compilers which do not understand `-c -o'. -scriptversion=2012-03-05.13; # UTC +scriptversion=2009-10-06.20; # UTC -# Copyright (C) 1999-2012 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software +# Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -28,219 +29,21 @@ scriptversion=2012-03-05.13; # UTC # bugs to or send patches to # . -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - case $1 in '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. +right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF @@ -250,13 +53,11 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; esac ofile= cfile= +eat= for arg do @@ -265,8 +66,8 @@ do else case $1 in -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) @@ -293,10 +94,10 @@ do done if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a + # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also + # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi @@ -305,7 +106,7 @@ fi cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# Note: use `[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d diff --git a/config/install-sh b/config/install-sh index 377bb8687f..6781b987bd 100755 --- a/config/install-sh +++ b/config/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2011-11-20.07; # UTC +scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -35,7 +35,7 @@ scriptversion=2011-11-20.07; # UTC # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it +# `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written @@ -156,10 +156,6 @@ while test $# -ne 0; do -s) stripcmd=$stripprog;; -t) dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac shift;; -T) no_target_directory=true;; @@ -190,10 +186,6 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then fi shift # arg dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac done fi @@ -202,17 +194,13 @@ if test $# -eq 0; then echo "$0: no input file specified." >&2 exit 1 fi - # It's OK to call 'install-sh -d' without argument. + # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 + trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. @@ -240,9 +228,9 @@ fi for src do - # Protect names problematic for 'test' and other utilities. + # Protect names starting with `-'. case $src in - -* | [=\(\)!]) src=./$src;; + -*) src=./$src;; esac if test -n "$dir_arg"; then @@ -264,7 +252,12 @@ do echo "$0: no destination specified." >&2 exit 1 fi + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. @@ -354,7 +347,7 @@ do if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. + # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in @@ -392,7 +385,7 @@ do case $dstdir in /*) prefix='/';; - [-=\(\)!]*) prefix='./';; + -*) prefix='./';; *) prefix='';; esac @@ -410,7 +403,7 @@ do for d do - test X"$d" = X && continue + test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then diff --git a/config/missing b/config/missing index 9a5564823d..28055d2ae6 100755 --- a/config/missing +++ b/config/missing @@ -1,9 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2012-01-06.18; # UTC +scriptversion=2009-04-28.21; # UTC -# Copyright (C) 1996-2012 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -25,7 +26,7 @@ scriptversion=2012-01-06.18; # UTC # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then - echo 1>&2 "Try '$0 --help' for more information" + echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi @@ -33,7 +34,7 @@ run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' -# In the cases where this matters, 'missing' is being run in the +# In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac @@ -64,7 +65,7 @@ case $1 in echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... -Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: @@ -73,20 +74,21 @@ Options: --run try to run the given command, and emulate it if it fails Supported PROGRAM values: - aclocal touch file 'aclocal.m4' - autoconf touch file 'configure' - autoheader touch file 'config.h.in' + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one - automake touch all 'Makefile.in' files - bison create 'y.tab.[ch]', if possible, from existing .[ch] - flex create 'lex.yy.c', if possible, from existing .c + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file - lex create 'lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file - yacc create 'y.tab.[ch]', if possible, from existing .[ch] + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] -Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and -'g' are ignored when checking the name. +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. Send bug reports to ." exit $? @@ -98,8 +100,8 @@ Send bug reports to ." ;; -*) - echo 1>&2 "$0: Unknown '$1' option" - echo 1>&2 "Try '$0 --help' for more information" + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; @@ -120,13 +122,22 @@ case $1 in # Not GNU programs, they don't have --version. ;; + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone - # running '$TOOL --version' or '$TOOL --help' to check whether + # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi @@ -138,27 +149,27 @@ esac case $program in aclocal*) echo 1>&2 "\ -WARNING: '$1' is $msg. You should only need it if - you modified 'acinclude.m4' or '${configure_ac}'. You might want - to install the Automake and Perl packages. Grab them from +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ -WARNING: '$1' is $msg. You should only need it if - you modified '${configure_ac}'. You might want to install the - Autoconf and GNU m4 packages. Grab them from any GNU +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ -WARNING: '$1' is $msg. You should only need it if - you modified 'acconfig.h' or '${configure_ac}'. You might want - to install the Autoconf and GNU m4 packages. Grab them +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" @@ -175,9 +186,9 @@ WARNING: '$1' is $msg. You should only need it if automake*) echo 1>&2 "\ -WARNING: '$1' is $msg. You should only need it if - you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'. - You might want to install the Automake and Perl packages. +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | @@ -186,10 +197,10 @@ WARNING: '$1' is $msg. You should only need it if autom4te*) echo 1>&2 "\ -WARNING: '$1' is needed, but is $msg. +WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. - You can get '$1' as part of Autoconf from any GNU + You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` @@ -209,13 +220,13 @@ WARNING: '$1' is needed, but is $msg. bison*|yacc*) echo 1>&2 "\ -WARNING: '$1' $msg. You should only need it if - you modified a '.y' file. You may need the Bison package +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get - Bison from any GNU archive site." + \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then - eval LASTARG=\${$#} + eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` @@ -239,13 +250,13 @@ WARNING: '$1' $msg. You should only need it if lex*|flex*) echo 1>&2 "\ -WARNING: '$1' is $msg. You should only need it if - you modified a '.l' file. You may need the Flex package +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get - Flex from any GNU archive site." + \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then - eval LASTARG=\${$#} + eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` @@ -262,10 +273,10 @@ WARNING: '$1' is $msg. You should only need it if help2man*) echo 1>&2 "\ -WARNING: '$1' is $msg. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the - Help2man package in order for those modifications to take - effect. You can get Help2man from any GNU archive site." + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` @@ -280,12 +291,12 @@ WARNING: '$1' is $msg. You should only need it if makeinfo*) echo 1>&2 "\ -WARNING: '$1' is $msg. You should only need it if - you modified a '.texi' or '.texinfo' file, or any other file +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy 'make' (AIX, - DU, IRIX). You might want to install the Texinfo package or - the GNU make package. Grab either from any GNU archive site." + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` @@ -307,14 +318,49 @@ WARNING: '$1' is $msg. You should only need it if touch $file ;; + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + *) echo 1>&2 "\ -WARNING: '$1' is needed, and is $msg. +WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the - proper tools for further handling them. Check the 'README' file, + proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case - some other package would contain this missing '$1' program." + some other package would contain this missing \`$1' program." exit 1 ;; esac From b1799904d8ff5d33ec668e35826de5e18ea0d8e4 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 11:23:45 +0200 Subject: [PATCH 12/28] hide the rest of the NL functions --- arangod/V8Server/v8-query.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arangod/V8Server/v8-query.cpp b/arangod/V8Server/v8-query.cpp index 3a014feb13..13212149c7 100755 --- a/arangod/V8Server/v8-query.cpp +++ b/arangod/V8Server/v8-query.cpp @@ -2528,22 +2528,22 @@ void TRI_InitV8Queries (v8::Handle context) { rt = v8g->VocbaseColTempl; rt->Set(AllFuncName, v8::FunctionTemplate::New(JS_AllQuery)); - rt->Set(AllNLFuncName, v8::FunctionTemplate::New(JS_AllNLQuery)); + rt->Set(AllNLFuncName, v8::FunctionTemplate::New(JS_AllNLQuery), v8::DontEnum); rt->Set(ByConditionBitarrayFuncName, v8::FunctionTemplate::New(JS_ByConditionBitarray)); - rt->Set(ByConditionBitarrayNLFuncName, v8::FunctionTemplate::New(JS_ByConditionNLBitarray)); + rt->Set(ByConditionBitarrayNLFuncName, v8::FunctionTemplate::New(JS_ByConditionNLBitarray), v8::DontEnum); rt->Set(ByConditionSkiplistFuncName, v8::FunctionTemplate::New(JS_ByConditionSkiplist)); - rt->Set(ByConditionSkiplistNLFuncName, v8::FunctionTemplate::New(JS_ByConditionNLSkiplist)); + rt->Set(ByConditionSkiplistNLFuncName, v8::FunctionTemplate::New(JS_ByConditionNLSkiplist), v8::DontEnum); rt->Set(ByExampleBitarrayFuncName, v8::FunctionTemplate::New(JS_ByExampleBitarray)); - rt->Set(ByExampleBitarrayNLFuncName, v8::FunctionTemplate::New(JS_ByExampleNLBitarray)); + rt->Set(ByExampleBitarrayNLFuncName, v8::FunctionTemplate::New(JS_ByExampleNLBitarray), v8::DontEnum); rt->Set(ByExampleFuncName, v8::FunctionTemplate::New(JS_ByExampleQuery)); rt->Set(ByExampleHashFuncName, v8::FunctionTemplate::New(JS_ByExampleHashIndex)); - rt->Set(ByExampleHashNLFuncName, v8::FunctionTemplate::New(JS_ByExampleNLHashIndex)); + rt->Set(ByExampleHashNLFuncName, v8::FunctionTemplate::New(JS_ByExampleNLHashIndex), v8::DontEnum); rt->Set(ByExampleSkiplistFuncName, v8::FunctionTemplate::New(JS_ByExampleSkiplist)); - rt->Set(ByExampleSkiplistNLFuncName, v8::FunctionTemplate::New(JS_ByExampleNLSkiplist)); + rt->Set(ByExampleSkiplistNLFuncName, v8::FunctionTemplate::New(JS_ByExampleNLSkiplist), v8::DontEnum); rt->Set(NearFuncName, v8::FunctionTemplate::New(JS_NearQuery)); - rt->Set(NearNLFuncName, v8::FunctionTemplate::New(JS_NearNLQuery)); + rt->Set(NearNLFuncName, v8::FunctionTemplate::New(JS_NearNLQuery), v8::DontEnum); rt->Set(WithinFuncName, v8::FunctionTemplate::New(JS_WithinQuery)); - rt->Set(WithinNLFuncName, v8::FunctionTemplate::New(JS_WithinNLQuery)); + rt->Set(WithinNLFuncName, v8::FunctionTemplate::New(JS_WithinNLQuery), v8::DontEnum); rt->Set(EdgesFuncName, v8::FunctionTemplate::New(JS_EdgesQuery)); rt->Set(InEdgesFuncName, v8::FunctionTemplate::New(JS_InEdgesQuery)); rt->Set(OutEdgesFuncName, v8::FunctionTemplate::New(JS_OutEdgesQuery)); From 95006138ed11118531de52c8ebaae53aba90738c Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 11:31:00 +0200 Subject: [PATCH 13/28] put parameters on individual lines --- arangod/VocBase/document-collection.c | 12 ++++++++---- arangod/VocBase/headers.c | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arangod/VocBase/document-collection.c b/arangod/VocBase/document-collection.c index 0abe9c3fdc..049395eba9 100755 --- a/arangod/VocBase/document-collection.c +++ b/arangod/VocBase/document-collection.c @@ -1011,8 +1011,10 @@ static TRI_doc_mptr_t CreateShapedJson (TRI_primary_collection_t* primary, marker._shape = json->_sid; return CreateDocument(collection, - &marker, sizeof(marker), - json->_data.data, json->_data.length, + &marker, + sizeof(marker), + json->_data.data, + json->_data.length, &result, data, did, @@ -1128,8 +1130,10 @@ static TRI_doc_mptr_t UpdateShapedJson (TRI_primary_collection_t* primary, return UpdateDocument(collection, header, - &marker, sizeof(marker), - json->_data.data, json->_data.length, + &marker, + sizeof(marker), + json->_data.data, + json->_data.length, rid, oldRid, policy, diff --git a/arangod/VocBase/headers.c b/arangod/VocBase/headers.c index bd7746f0a8..6526ce4410 100644 --- a/arangod/VocBase/headers.c +++ b/arangod/VocBase/headers.c @@ -91,7 +91,7 @@ static TRI_doc_mptr_t* RequestSimpleHeaders (TRI_headers_t* h) { begin = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, NUMBER_HEADERS_PER_BLOCK * headers->_headerSize, false); // out of memory - if (!begin) { + if (begin == NULL) { TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY); return NULL; } From 2fc2693ddcb2067aad948a540ad628ab569e172b Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 15:57:29 +0200 Subject: [PATCH 14/28] fixed uint32_t overrun in hash index address calculation --- arangod/HashIndex/compare.h | 2 -- arangod/HashIndex/hasharray.c | 20 +++----------------- arangod/HashIndex/hasharray.h | 7 +++---- arangod/HashIndex/hashindex.h | 4 ++-- 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/arangod/HashIndex/compare.h b/arangod/HashIndex/compare.h index 662f616d21..fdc853f508 100755 --- a/arangod/HashIndex/compare.h +++ b/arangod/HashIndex/compare.h @@ -93,7 +93,6 @@ static void IndexStaticClearElement(TRI_hasharray_t* array, void* element) { hElement->numFields = 0; hElement->fields = 0; hElement->data = 0; - hElement->collection = 0; } } @@ -116,7 +115,6 @@ static bool IndexStaticCopyElementElement (TRI_hasharray_t* array, void* left, v leftElement->numFields = rightElement->numFields; leftElement->data = rightElement->data; - leftElement->collection = rightElement->collection; leftElement->fields = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_shaped_json_t) * leftElement->numFields, false); if (leftElement->fields == NULL) { diff --git a/arangod/HashIndex/hasharray.c b/arangod/HashIndex/hasharray.c index 90274b5b40..20380c601f 100755 --- a/arangod/HashIndex/hasharray.c +++ b/arangod/HashIndex/hasharray.c @@ -74,9 +74,6 @@ bool TRI_InitHashArray (TRI_hasharray_t* array, bool (*isEmptyElement) (TRI_hasharray_t*, void*), bool (*isEqualKeyElement) (TRI_hasharray_t*, void*, void*), bool (*isEqualElementElement) (TRI_hasharray_t*, void*, void*)) { - char* p; - char* e; - // ........................................................................... // Assign the callback functions @@ -89,6 +86,7 @@ bool TRI_InitHashArray (TRI_hasharray_t* array, array->_elementSize = elementSize; + array->_table = NULL; array->_nrAlloc = 10; @@ -98,6 +96,8 @@ bool TRI_InitHashArray (TRI_hasharray_t* array, array->_table = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, array->_elementSize * array->_nrAlloc, true); if (array->_table == NULL) { + array->_nrAlloc = 0; + return false; } @@ -106,12 +106,6 @@ bool TRI_InitHashArray (TRI_hasharray_t* array, // Go through and 'zero' (clear) each item in the hash array // ........................................................................... - p = array->_table; - e = p + array->_elementSize * array->_nrAlloc; - for (; p < e; p += array->_elementSize) { - IndexStaticClearElement(array, p); - } - array->_nrUsed = 0; array->_nrFinds = 0; array->_nrAdds = 0; @@ -1157,10 +1151,6 @@ static bool ResizeHashArray (TRI_hasharray_t* array) { array->_nrUsed = 0; array->_nrResizes++; - for (j = 0; j < array->_nrAlloc; j++) { - IndexStaticClearElement(array, array->_table + j * array->_elementSize); - } - for (j = 0; j < oldAlloc; j++) { if (! IndexStaticIsEmptyElement(array, oldTable + j * array->_elementSize)) { AddNewElement(array, oldTable + j * array->_elementSize); @@ -1198,10 +1188,6 @@ static bool ResizeHashArrayMulti (TRI_hasharray_t* array) { array->_nrUsed = 0; array->_nrResizes++; - for (j = 0; j < array->_nrAlloc; j++) { - IndexStaticClearElement(array, array->_table + j * array->_elementSize); - } - for (j = 0; j < oldAlloc; j++) { if (! IndexStaticIsEmptyElement(array, oldTable + j * array->_elementSize)) { AddNewElement(array, oldTable + j * array->_elementSize); diff --git a/arangod/HashIndex/hasharray.h b/arangod/HashIndex/hasharray.h index 1d40c06b28..eff6911caf 100755 --- a/arangod/HashIndex/hasharray.h +++ b/arangod/HashIndex/hasharray.h @@ -60,10 +60,9 @@ typedef struct TRI_hasharray_s { bool (*isEqualElementElement) (struct TRI_hasharray_s*, void*, void*); - uint32_t _elementSize; - - uint32_t _nrAlloc; // the size of the table - uint32_t _nrUsed; // the number of used entries + uint64_t _elementSize; + uint64_t _nrAlloc; // the size of the table + uint64_t _nrUsed; // the number of used entries char* _table; // the table itself diff --git a/arangod/HashIndex/hashindex.h b/arangod/HashIndex/hashindex.h index 815526f723..435827ecef 100755 --- a/arangod/HashIndex/hashindex.h +++ b/arangod/HashIndex/hashindex.h @@ -62,8 +62,8 @@ typedef struct { typedef struct { size_t numFields; // the number of fields TRI_shaped_json_t* fields; // list of shaped json objects the blob of data within will be hashed - void* data; // master document pointer - void* collection; + void* data; // master document pointer + void* collection; // currently not used } HashIndexElement; typedef struct { From 9d18171d18e0dcefbc056a28221058e054c66a89 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 16:48:28 +0200 Subject: [PATCH 15/28] added TODO marker --- arangod/SkipLists/skiplist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arangod/SkipLists/skiplist.c b/arangod/SkipLists/skiplist.c index 700acbcb5e..c457fe7680 100755 --- a/arangod/SkipLists/skiplist.c +++ b/arangod/SkipLists/skiplist.c @@ -400,6 +400,7 @@ void TRI_InitSkipList (TRI_skiplist_t* skiplist, size_t elementSize, // do it here once off. // .......................................................................... skiplist->_base._random = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(uint32_t) * skiplist->_base._numRandom, false); + // TODO: memory allocation might fail // .......................................................................... // Assign the element size From 79646372f48b938266917e6a25153d3b7d519ae0 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 18:00:54 +0200 Subject: [PATCH 16/28] fixed a typo --- arangod/Documentation/glossary.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arangod/Documentation/glossary.dox b/arangod/Documentation/glossary.dox index 1233de6caf..2fccb9b1ff 100644 --- a/arangod/Documentation/glossary.dox +++ b/arangod/Documentation/glossary.dox @@ -125,7 +125,7 @@ /// /// @GE{Edge}: Edges in ArangoDB are special documents. In addition to the /// internal attributes @LIT{_id} and @LIT{_rev}, they have two attributes -/// @LIT{_form} and @LIT{_to}, which contain document handles namely the +/// @LIT{_from} and @LIT{_to}, which contain document handles namely the /// start-point and the end-point of the edge. /// /// @page GlossaryEdgeCollection From d23555cfe1ada9ed5c4bb38a5775d0d3dc974dda Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 19:09:01 +0200 Subject: [PATCH 17/28] issue #231: handle some obviously invalid requests --- lib/HttpServer/HttpCommTask.h | 54 +++++++++++++++++++++++---- lib/HttpServer/HttpHandlerFactory.cpp | 7 ++-- lib/Rest/HttpResponse.cpp | 3 ++ lib/Rest/HttpResponse.h | 3 ++ 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/lib/HttpServer/HttpCommTask.h b/lib/HttpServer/HttpCommTask.h index 14a60e9c99..95953bf10a 100644 --- a/lib/HttpServer/HttpCommTask.h +++ b/lib/HttpServer/HttpCommTask.h @@ -154,9 +154,12 @@ namespace triagens { size_t headerLength = ptr - this->_readBuffer->c_str(); if (headerLength > this->_maximalHeaderSize) { - LOGGER_WARNING << "maximal header size is " << this->_maximalHeaderSize << ", request header size is " - << headerLength; - return false; + LOGGER_WARNING << "maximal header size is " << this->_maximalHeaderSize << ", request header size is " << headerLength; + // header is too large + HttpResponse response(HttpResponse::HEADER_TOO_LARGE); + this->handleResponse(&response); + + return true; } if (ptr < end) { @@ -170,6 +173,10 @@ namespace triagens { if (this->_request == 0) { LOGGER_ERROR << "cannot generate request"; + // internal server error + HttpResponse response(HttpResponse::SERVER_ERROR); + this->handleResponse(&response); + return false; } @@ -208,6 +215,14 @@ namespace triagens { if (this->_bodyLength > 0) { this->_readRequestBody = true; + + if (this->_bodyLength > this->_maximalBodySize) { + LOGGER_WARNING << "maximal body size is " << this->_maximalBodySize << ", request body size is " << this->_bodyLength; + // request entity too large + HttpResponse response(HttpResponse::ENTITY_TOO_LARGE); + this->handleResponse(&response); + return true; + } } else { handleRequest = true; @@ -216,7 +231,10 @@ namespace triagens { default: LOGGER_WARNING << "got corrupted HTTP request '" << string(this->_readBuffer->c_str(), (this->_readPosition < 6 ? this->_readPosition : 6)) << "'"; - return false; + // bad request + HttpResponse response(HttpResponse::BAD); + this->handleResponse(&response); + return true; } // check for a 100-continue @@ -251,7 +269,11 @@ namespace triagens { if (this->_readRequestBody) { if (this->_bodyLength > this->_maximalBodySize) { LOGGER_WARNING << "maximal body size is " << this->_maximalBodySize << ", request body size is " << this->_bodyLength; - return false; + // request entity too large + HttpResponse response(HttpResponse::ENTITY_TOO_LARGE); + this->handleResponse(&response); + + return true; } if (this->_readBuffer->length() - this->_bodyPosition < this->_bodyLength) { @@ -275,8 +297,26 @@ namespace triagens { this->_readBuffer->erase_front(this->_bodyPosition + this->_bodyLength); - if (this->_readBuffer->length() > 2) { - LOGGER_WARNING << "read buffer is not empty. probably got a wrong Content-Length header?"; + if (this->_readBuffer->length() > 0) { + // we removed the front of the read buffer, but it still contains data. + // this means that the content-length header of the request must have been wrong + // (value in content-length header smaller than actual body size) + + // check if there is invalid stuff left in the readbuffer + // whitespace is allowed + const char* p = this->_readBuffer->begin(); + const char* e = this->_readBuffer->end(); + while (p < e) { + const char c = *(p++); + if (c != '\n' && c != '\r' && c != ' ' && c != '\t' && c != '\0') { + LOGGER_WARNING << "read buffer is not empty. probably got a wrong Content-Length header?"; + + HttpResponse response(HttpResponse::BAD); + this->handleResponse(&response); + + return true; + } + } } this->_requestPending = true; diff --git a/lib/HttpServer/HttpHandlerFactory.cpp b/lib/HttpServer/HttpHandlerFactory.cpp index 677193845b..89b01ed776 100644 --- a/lib/HttpServer/HttpHandlerFactory.cpp +++ b/lib/HttpServer/HttpHandlerFactory.cpp @@ -128,9 +128,10 @@ void HttpHandlerFactory::setRequireAuthentication (bool value) { //////////////////////////////////////////////////////////////////////////////// pair HttpHandlerFactory::sizeRestrictions () const { - static size_t m = (size_t) -1; - - return make_pair(m, m); + // size restrictions: + // - header: 1 MB + // - body: 512 MB + return make_pair(1 * 1024 * 1024, 512 * 1024 * 1024); } //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/Rest/HttpResponse.cpp b/lib/Rest/HttpResponse.cpp index f6fc94960b..ce961ef703 100644 --- a/lib/Rest/HttpResponse.cpp +++ b/lib/Rest/HttpResponse.cpp @@ -74,8 +74,11 @@ string HttpResponse::responseString (HttpResponseCode code) { case NOT_FOUND: return "404 Not Found"; case METHOD_NOT_ALLOWED: return "405 Method Not Supported"; case CONFLICT: return "409 Conflict"; + case LENGTH_REQUIRED: return "411 Length Required"; case PRECONDITION_FAILED: return "412 Precondition Failed"; + case ENTITY_TOO_LARGE: return "413 Request Entity Too Large"; case UNPROCESSABLE_ENTITY: return "422 Unprocessable Entity"; + case HEADER_TOO_LARGE: return "431 Request Header Fields Too Large"; case SERVER_ERROR: return "500 Internal Error"; case NOT_IMPLEMENTED: return "501 Not Implemented"; diff --git a/lib/Rest/HttpResponse.h b/lib/Rest/HttpResponse.h index d6563310b1..3075eae5c5 100644 --- a/lib/Rest/HttpResponse.h +++ b/lib/Rest/HttpResponse.h @@ -97,8 +97,11 @@ namespace triagens { NOT_FOUND = 404, METHOD_NOT_ALLOWED = 405, CONFLICT = 409, + LENGTH_REQUIRED = 411, PRECONDITION_FAILED = 412, + ENTITY_TOO_LARGE = 413, UNPROCESSABLE_ENTITY = 422, + HEADER_TOO_LARGE = 431, SERVER_ERROR = 500, NOT_IMPLEMENTED = 501, From 7449a529b360606395af65713e6c7da07be8b46e Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 19:28:16 +0200 Subject: [PATCH 18/28] cosmetics --- lib/HttpServer/HttpCommTask.h | 1 + lib/Scheduler/SocketTask.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/HttpServer/HttpCommTask.h b/lib/HttpServer/HttpCommTask.h index 95953bf10a..385468bfac 100644 --- a/lib/HttpServer/HttpCommTask.h +++ b/lib/HttpServer/HttpCommTask.h @@ -277,6 +277,7 @@ namespace triagens { } if (this->_readBuffer->length() - this->_bodyPosition < this->_bodyLength) { + // still more data to be read return true; } diff --git a/lib/Scheduler/SocketTask.cpp b/lib/Scheduler/SocketTask.cpp index e106b8f8ff..704307c352 100644 --- a/lib/Scheduler/SocketTask.cpp +++ b/lib/Scheduler/SocketTask.cpp @@ -136,7 +136,7 @@ bool SocketTask::fillReadBuffer (bool& closed) { else if (nr == 0) { closed = true; - LOGGER_TRACE << "read return 0 with " << errno << " (" << strerror(errno) << ")"; + LOGGER_TRACE << "read returned 0"; return false; } From b60c05c4a6289abe57c861ecacd8634ab31cc6fc Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 20:34:13 +0200 Subject: [PATCH 19/28] fixed typo in .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f57783fb65..d3c09675e0 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ mr-*.h .setup-mr-directories .setup-js-directories 3rdParty/libev/ARCH.x64/ -3rdParty/libev/ARCH.IA32/ +3rdParty/libev/ARCH.ia32/ Doxygen/doc/ Doxygen/manuals/ From 6a7d1e57c7f1f92c5178182943d3409b0413b104 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 21:34:28 +0200 Subject: [PATCH 20/28] issue #231: set request timeout for requests that come in incomplete --- lib/HttpServer/HttpCommTask.h | 9 +++++++++ lib/Scheduler/SocketTask.cpp | 30 ++++++++++++++++++++++++++---- lib/Scheduler/SocketTask.h | 21 +++++++++++++++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/lib/HttpServer/HttpCommTask.h b/lib/HttpServer/HttpCommTask.h index 385468bfac..1b37b4fe9e 100644 --- a/lib/HttpServer/HttpCommTask.h +++ b/lib/HttpServer/HttpCommTask.h @@ -278,6 +278,15 @@ namespace triagens { if (this->_readBuffer->length() - this->_bodyPosition < this->_bodyLength) { // still more data to be read + + SocketTask* socketTask = dynamic_cast(this); + if (socketTask) { + // set read request time-out + LOGGER_TRACE << "waiting for rest of body to be received. request timeout set to 60 s"; + socketTask->setKeepAliveTimeout(60.0); + } + + // let client send more return true; } diff --git a/lib/Scheduler/SocketTask.cpp b/lib/Scheduler/SocketTask.cpp index 704307c352..9f149f2073 100644 --- a/lib/Scheduler/SocketTask.cpp +++ b/lib/Scheduler/SocketTask.cpp @@ -110,6 +110,29 @@ SocketTask::~SocketTask () { /// @} //////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- public methods +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup Scheduler +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// {@inheritDoc} +//////////////////////////////////////////////////////////////////////////////// + +void SocketTask::setKeepAliveTimeout (double timeout) { + if (keepAliveWatcher != 0 && timeout > 0.0) { + scheduler->rearmTimer(keepAliveWatcher, timeout); + } +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + // ----------------------------------------------------------------------------- // --SECTION-- protected virtual methods // ----------------------------------------------------------------------------- @@ -221,10 +244,8 @@ bool SocketTask::handleWrite (bool& closed, bool noWrite) { } // rearm timer for keep-alive timeout - if (_keepAliveTimeout > 0.0) { - // TODO: do we need some lock before we modify the scheduler? - scheduler->rearmTimer(keepAliveWatcher, _keepAliveTimeout); - } + // TODO: do we need some lock before we modify the scheduler? + setKeepAliveTimeout(_keepAliveTimeout); } // we might have a new write buffer or none at all @@ -444,6 +465,7 @@ bool SocketTask::handleEvent (EventToken token, EventType revents) { // disable timer for keep-alive timeout scheduler->clearTimer(keepAliveWatcher); } + result = handleRead(closed); } diff --git a/lib/Scheduler/SocketTask.h b/lib/Scheduler/SocketTask.h index b8c96e69ae..f6db8a1b9e 100644 --- a/lib/Scheduler/SocketTask.h +++ b/lib/Scheduler/SocketTask.h @@ -104,6 +104,27 @@ namespace triagens { /// @} //////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- public methods +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup Scheduler +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// set a request timeout +//////////////////////////////////////////////////////////////////////////////// + + public: + + void setKeepAliveTimeout (double); + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + // ----------------------------------------------------------------------------- // --SECTION-- protected virtual methods // ----------------------------------------------------------------------------- From a1051183b83eead3c18953ac06cce3daf611f25e Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 22:09:08 +0200 Subject: [PATCH 21/28] remove unnecessary response headers in sub responses --- arangod/RestHandler/RestBatchHandler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arangod/RestHandler/RestBatchHandler.cpp b/arangod/RestHandler/RestBatchHandler.cpp index f65d1da0bd..d83118173e 100644 --- a/arangod/RestHandler/RestBatchHandler.cpp +++ b/arangod/RestHandler/RestBatchHandler.cpp @@ -250,9 +250,13 @@ Handler::status_e RestBatchHandler::execute() { _response->body().appendText("\r\n\r\n", 4); - // append the response header + // remove some headers we don't need + partResponse->setHeader("connection", 10, ""); + partResponse->setHeader("server", 6, ""); + + // append the part response header partResponse->writeHeader(&_response->body()); - // append the response body + // append the part response body _response->body().appendText(partResponse->body()); _response->body().appendText("\r\n", 2); From 634adedbf654eff8ebcf3d6ee624347d025356c1 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 15 Oct 2012 22:52:50 +0200 Subject: [PATCH 22/28] vastly improved error messages for end user --- arangod/V8Server/v8-vocbase.cpp | 111 ++++++++++++-------------------- lib/V8/v8-utils.cpp | 66 ++++++++++++------- lib/V8/v8-utils.h | 14 +++- 3 files changed, 98 insertions(+), 93 deletions(-) diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 0bd6405752..26dbef4dde 100755 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -334,13 +334,13 @@ static TRI_vocbase_col_t const* UseCollection (v8::Handle collection int res = TRI_UseCollectionVocBase(col->_vocbase, col); if (res != TRI_ERROR_NO_ERROR) { - *err = TRI_CreateErrorObject(res, "cannot use/load collection"); + *err = TRI_CreateErrorObject(res, "cannot use/load collection", true); return 0; } if (col->_collection == 0) { TRI_set_errno(TRI_ERROR_INTERNAL); - *err = TRI_CreateErrorObject(TRI_ERROR_INTERNAL, "cannot use/load collection"); + *err = TRI_CreateErrorObject(TRI_ERROR_INTERNAL, "cannot use/load collection", true); return 0; } @@ -530,7 +530,7 @@ static v8::Handle EnsurePathIndex (string const& cmd, if (idx == 0) { if (create) { TRI_ReleaseCollection(collection); - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "index could not be created"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "index could not be created", true))); } else { TRI_ReleaseCollection(collection); @@ -728,9 +728,7 @@ static v8::Handle ReplaceVocbaseCol (TRI_vocbase_t* vocbase, if (mptr._did == 0) { TRI_ReleaseCollection(collection); - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_errno(), - "cannot replace document"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_errno(), "cannot replace document", true))); } string id = StringUtils::itoa(primary->base._cid) + string(TRI_DOCUMENT_HANDLE_SEPARATOR_STR) + StringUtils::itoa(mptr._did); @@ -835,9 +833,7 @@ static v8::Handle SaveVocbaseCol (TRI_vocbase_col_t const* collection TRI_FreeShapedJson(primary->_shaper, shaped); if (mptr._did == 0) { - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_errno(), - "cannot save document"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_errno(), "cannot save document", true))); } string id = StringUtils::itoa(primary->base._cid) + string(TRI_DOCUMENT_HANDLE_SEPARATOR_STR) + StringUtils::itoa(mptr._did); @@ -975,9 +971,7 @@ static v8::Handle SaveEdgeCol (TRI_vocbase_col_t const* collection, TRI_FreeShapedJson(primary->_shaper, shaped); if (mptr._did == 0) { - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_errno(), - "cannot save document"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_errno(), "cannot save document", true))); } string id = StringUtils::itoa(primary->base._cid) + string(TRI_DOCUMENT_HANDLE_SEPARATOR_STR) + StringUtils::itoa(mptr._did); @@ -1096,9 +1090,7 @@ static v8::Handle UpdateVocbaseCol (TRI_vocbase_t* vocbase, if (mptr._did == 0) { TRI_ReleaseCollection(collection); - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_errno(), - "cannot update document"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_errno(), "cannot update document", true))); } string id = StringUtils::itoa(primary->base._cid) + string(TRI_DOCUMENT_HANDLE_SEPARATOR_STR) + StringUtils::itoa(mptr._did); @@ -1180,7 +1172,7 @@ static v8::Handle DeleteVocbaseCol (TRI_vocbase_t* vocbase, return scope.Close(v8::False()); } else { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot delete document"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot delete document", true))); } } @@ -1275,7 +1267,7 @@ static v8::Handle CreateVocBase (v8::Arguments const& argv, TRI_col_t TRI_vocbase_col_t const* collection = TRI_CreateCollectionVocBase(vocbase, ¶meter, cid); if (collection == 0) { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_errno(), "cannot create collection"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_errno(), "cannot create collection", true))); } return scope.Close(TRI_WrapCollection(collection)); @@ -1442,13 +1434,12 @@ static v8::Handle EnsureGeoIndexVocbaseCol (v8::Arguments const& argv if (idx == 0) { TRI_ReleaseCollection(collection); return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_errno(), - "index could not be created"))); + TRI_CreateErrorObject(TRI_errno(), "index could not be created", true))); } TRI_json_t* json = idx->json(idx, collection->_collection); - if (!json) { + if (! json) { TRI_ReleaseCollection(collection); return scope.Close(v8::ThrowException(v8::String::New("out of memory"))); } @@ -1478,7 +1469,7 @@ static v8::Handle CreateErrorObjectAhuacatl (TRI_aql_error_t* error) return TRI_CreateErrorObject(TRI_GetErrorCodeAql(error), str); } - return TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY, "out of memory"); + return TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY); } //////////////////////////////////////////////////////////////////////////////// @@ -1547,7 +1538,7 @@ static v8::Handle ExecuteQueryCursorAhuacatl (TRI_vocbase_t* const vo TRI_json_t* json = TRI_JsonObject(result); if (!json) { - v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY, "out of memory"); + v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY); return scope.Close(v8::ThrowException(errorObject)); } @@ -1557,7 +1548,7 @@ static v8::Handle ExecuteQueryCursorAhuacatl (TRI_vocbase_t* const vo if (!cursorResult) { TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); - v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY, "out of memory"); + v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY); return scope.Close(v8::ThrowException(errorObject)); } @@ -1567,7 +1558,7 @@ static v8::Handle ExecuteQueryCursorAhuacatl (TRI_vocbase_t* const vo TRI_Free(TRI_UNKNOWN_MEM_ZONE, cursorResult); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); - v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY, "out of memory"); + v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY); return scope.Close(v8::ThrowException(errorObject)); } @@ -1795,8 +1786,7 @@ static v8::Handle JS_CreateCursor (v8::Arguments const& argv) { if (cursor == 0) { return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_INTERNAL, - "cannot create cursor"))); + TRI_CreateErrorObject(TRI_ERROR_INTERNAL, "cannot create cursor"))); } TRI_StoreShadowData(vocbase->_cursors, (const void* const) cursor); @@ -1861,8 +1851,7 @@ static v8::Handle JS_IdGeneralCursor (v8::Arguments const& argv) { } return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } //////////////////////////////////////////////////////////////////////////////// @@ -1897,8 +1886,7 @@ static v8::Handle JS_CountGeneralCursor (v8::Arguments const& argv) { } return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } //////////////////////////////////////////////////////////////////////////////// @@ -1969,9 +1957,7 @@ static v8::Handle JS_NextGeneralCursor (v8::Arguments const& argv) { } } - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } //////////////////////////////////////////////////////////////////////////////// @@ -2001,9 +1987,7 @@ static v8::Handle JS_PersistGeneralCursor (v8::Arguments const& argv) return scope.Close(v8::True()); } - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } //////////////////////////////////////////////////////////////////////////////// @@ -2072,9 +2056,7 @@ static v8::Handle JS_GetRowsGeneralCursor (v8::Arguments const& argv) } } - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } //////////////////////////////////////////////////////////////////////////////// @@ -2109,9 +2091,7 @@ static v8::Handle JS_GetBatchSizeGeneralCursor (v8::Arguments const& return scope.Close(v8::Number::New(max)); } - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } //////////////////////////////////////////////////////////////////////////////// @@ -2146,9 +2126,7 @@ static v8::Handle JS_HasCountGeneralCursor (v8::Arguments const& argv return scope.Close(hasCount ? v8::True() : v8::False()); } - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } //////////////////////////////////////////////////////////////////////////////// @@ -2186,9 +2164,7 @@ static v8::Handle JS_HasNextGeneralCursor (v8::Arguments const& argv) return scope.Close(hasNext ? v8::True() : v8::False()); } - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } //////////////////////////////////////////////////////////////////////////////// @@ -2255,9 +2231,7 @@ static v8::Handle JS_Cursor (v8::Arguments const& argv) { cursor = (TRI_general_cursor_t*) TRI_BeginUsageIdShadowData(vocbase->_cursors, id); if (cursor == 0) { - return scope.Close(v8::ThrowException( - TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND, - "disposed or unknown cursor"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_CURSOR_NOT_FOUND))); } return scope.Close(WrapGeneralCursor(cursor)); @@ -2367,7 +2341,7 @@ static v8::Handle JS_RunAhuacatl (v8::Arguments const& argv) { AhuacatlContextGuard context(vocbase, queryString); if (! context.valid()) { - v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY, "out of memory"); + v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY); return scope.Close(v8::ThrowException(errorObject)); } @@ -2425,7 +2399,7 @@ static v8::Handle JS_ExplainAhuacatl (v8::Arguments const& argv) { AhuacatlContextGuard context(vocbase, queryString); if (! context.valid()) { - v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY, "out of memory"); + v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY); return scope.Close(v8::ThrowException(errorObject)); } @@ -2496,7 +2470,7 @@ static v8::Handle JS_ParseAhuacatl (v8::Arguments const& argv) { AhuacatlContextGuard context(vocbase, queryString); if (! context.valid()) { - v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY, "out of memory"); + v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY); return scope.Close(v8::ThrowException(errorObject)); } @@ -2576,8 +2550,7 @@ static v8::Handle JS_DatafileScanVocbaseCol (v8::Arguments const& arg if (collection->_status != TRI_VOC_COL_STATUS_UNLOADED) { TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection); - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ARANGO_COLLECTION_NOT_UNLOADED, - "collection must be unloaded"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ARANGO_COLLECTION_NOT_UNLOADED))); } TRI_df_scan_t scan = TRI_ScanDatafile(path.c_str()); @@ -2681,8 +2654,7 @@ static v8::Handle JS_DatafilesVocbaseCol (v8::Arguments const& argv) if (collection->_status != TRI_VOC_COL_STATUS_UNLOADED) { TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection); - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ARANGO_COLLECTION_NOT_UNLOADED, - "collection must be unloaded"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ARANGO_COLLECTION_NOT_UNLOADED))); } TRI_col_file_structure_t structure = TRI_FileStructureCollectionDirectory(collection->_path); @@ -2825,7 +2797,7 @@ static v8::Handle JS_DropVocbaseCol (v8::Arguments const& argv) { } if (res != TRI_ERROR_NO_ERROR) { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot drop collection"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot drop collection", true))); } return scope.Close(v8::Undefined()); @@ -2978,7 +2950,7 @@ static v8::Handle JS_EnsureCapConstraintVocbaseCol (v8::Arguments con if (idx == 0) { TRI_ReleaseCollection(collection); - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_errno(), "index could not be created"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_errno(), "index could not be created", true))); } TRI_json_t* json = idx->json(idx, collection->_collection); @@ -3604,7 +3576,7 @@ static v8::Handle JS_FiguresVocbaseCol (v8::Arguments const& argv) { if (info == NULL) { TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection); - v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY, "out of memory"); + v8::Handle errorObject = TRI_CreateErrorObject(TRI_ERROR_OUT_OF_MEMORY); return scope.Close(v8::ThrowException(errorObject)); } @@ -4001,7 +3973,7 @@ static v8::Handle JS_RenameVocbaseCol (v8::Arguments const& argv) { int res = TRI_RenameCollectionVocBase(collection->_vocbase, collection, name.c_str()); if (res != TRI_ERROR_NO_ERROR) { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot rename collection"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot rename collection", true))); } return scope.Close(v8::Undefined()); @@ -4228,7 +4200,7 @@ static v8::Handle JS_SetAttributeVocbaseCol (v8::Arguments const& arg TRI_WRITE_UNLOCK_STATUS_VOCBASE_COL(collection); if (res != TRI_ERROR_NO_ERROR) { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "setAttribute failed"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "setAttribute failed", true))); } return scope.Close(v8::Undefined()); @@ -4341,8 +4313,7 @@ static v8::Handle JS_TruncateDatafileVocbaseCol (v8::Arguments const& if (collection->_status != TRI_VOC_COL_STATUS_UNLOADED) { TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection); - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ARANGO_COLLECTION_NOT_UNLOADED, - "collection must be unloaded"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ARANGO_COLLECTION_NOT_UNLOADED))); } int res = TRI_TruncateDatafile(path.c_str(), size); @@ -4350,7 +4321,7 @@ static v8::Handle JS_TruncateDatafileVocbaseCol (v8::Arguments const& TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection); if (res != TRI_ERROR_NO_ERROR) { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot truncate datafile"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot truncate datafile", true))); } return scope.Close(v8::Undefined()); @@ -4407,7 +4378,7 @@ static v8::Handle JS_UnloadVocbaseCol (v8::Arguments const& argv) { int res = TRI_UnloadCollectionVocBase(collection->_vocbase, collection); if (res != TRI_ERROR_NO_ERROR) { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot unload collection"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot unload collection", true))); } return scope.Close(v8::Undefined()); @@ -4432,7 +4403,7 @@ static v8::Handle JS_VersionVocbaseCol (v8::Arguments const& argv) { TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection); if (res != TRI_ERROR_NO_ERROR) { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot fetch collection info"))); + return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot fetch collection info", true))); } return scope.Close(v8::Number::New((int) info._version)); @@ -5347,7 +5318,7 @@ v8::Handle TRI_ParseDocumentOrDocumentHandle (TRI_vocbase_t* vocbase, int res = TRI_UseCollectionVocBase(vocbase, vc); if (res != TRI_ERROR_NO_ERROR) { - return scope.Close(TRI_CreateErrorObject(res, "cannot use/load collection"));; + return scope.Close(TRI_CreateErrorObject(res, "cannot use/load collection", true)); } } @@ -5426,7 +5397,7 @@ TRI_index_t* TRI_LookupIndexByHandle (TRI_vocbase_t* vocbase, int res = TRI_UseCollectionVocBase(vocbase, vc); if (res != TRI_ERROR_NO_ERROR) { - *err = TRI_CreateErrorObject(res, "cannot use/load collection"); + *err = TRI_CreateErrorObject(res, "cannot use/load collection", true); return 0; } diff --git a/lib/V8/v8-utils.cpp b/lib/V8/v8-utils.cpp index a71cd01467..d9895e6ca8 100644 --- a/lib/V8/v8-utils.cpp +++ b/lib/V8/v8-utils.cpp @@ -393,6 +393,31 @@ static v8::Handle MapSetWeakDictionary (v8::Local name, /// @{ //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @brief create a Javascript error object +//////////////////////////////////////////////////////////////////////////////// + +static v8::Handle CreateErrorObject (int errorNumber, string const& message) { + TRI_v8_global_t* v8g; + v8::HandleScope scope; + + v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); + + v8::Handle errorMessage = v8::String::New(message.c_str()); + + v8::Handle errorObject = v8::Exception::Error(errorMessage)->ToObject(); + v8::Handle proto = v8g->ErrorTempl->NewInstance(); + + errorObject->Set(v8::String::New("errorNum"), v8::Number::New(errorNumber)); + errorObject->Set(v8::String::New("errorMessage"), errorMessage); + + if (! proto.IsEmpty()) { + errorObject->SetPrototype(proto); + } + + return errorObject; +} + //////////////////////////////////////////////////////////////////////////////// /// @brief reads/execute a file into/in the current context //////////////////////////////////////////////////////////////////////////////// @@ -821,7 +846,7 @@ static v8::Handle JS_Move (v8::Arguments const& argv) { int res = TRI_RenameFile(source.c_str(), destination.c_str()); if (res != TRI_ERROR_NO_ERROR) { - return scope.Close(v8::ThrowException(TRI_CreateErrorObject(res, "cannot move file"))); + return scope.Close(v8::ThrowException(CreateErrorObject(res, "cannot move file"))); } return scope.Close(v8::Undefined());; @@ -1498,35 +1523,32 @@ v8::Handle TRI_ExecuteJavaScriptString (v8::Handle conte } //////////////////////////////////////////////////////////////////////////////// -/// @brief creates an error in a javascript object +/// @brief creates an error in a javascript object, based on error number only +//////////////////////////////////////////////////////////////////////////////// + +v8::Handle TRI_CreateErrorObject (int errorNumber) { + return CreateErrorObject(errorNumber, TRI_errno_string(errorNumber)); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief creates an error in a javascript object, using supplied text //////////////////////////////////////////////////////////////////////////////// v8::Handle TRI_CreateErrorObject (int errorNumber, string const& message) { - TRI_v8_global_t* v8g; - v8::HandleScope scope; + return CreateErrorObject(errorNumber, message); +} - v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); +//////////////////////////////////////////////////////////////////////////////// +/// @brief creates an error in a javascript object +//////////////////////////////////////////////////////////////////////////////// - string msg; - if (message.size()) { - msg = message; +v8::Handle TRI_CreateErrorObject (int errorNumber, string const& message, bool autoPrepend) { + if (autoPrepend) { + return CreateErrorObject(errorNumber, message + ": " + string(TRI_errno_string(errorNumber))); } else { - msg = TRI_errno_string(errorNumber) + string(": ") + message; + return CreateErrorObject(errorNumber, message); } - v8::Handle errorMessage = v8::String::New(msg.c_str()); - - v8::Handle errorObject = v8::Exception::Error(errorMessage)->ToObject(); - v8::Handle proto = v8g->ErrorTempl->NewInstance(); - - errorObject->Set(v8::String::New("errorNum"), v8::Number::New(errorNumber)); - errorObject->Set(v8::String::New("errorMessage"), errorMessage); - - if (! proto.IsEmpty()) { - errorObject->SetPrototype(proto); - } - - return errorObject; } //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/V8/v8-utils.h b/lib/V8/v8-utils.h index 1cac05c673..1ebd5e7857 100644 --- a/lib/V8/v8-utils.h +++ b/lib/V8/v8-utils.h @@ -139,11 +139,23 @@ v8::Handle TRI_ExecuteJavaScriptString (v8::Handle conte bool printResult); //////////////////////////////////////////////////////////////////////////////// -/// @brief creates an error in a javascript object +/// @brief creates an error in a javascript object, based on error number only +//////////////////////////////////////////////////////////////////////////////// + +v8::Handle TRI_CreateErrorObject (int errorNumber); + +//////////////////////////////////////////////////////////////////////////////// +/// @brief creates an error in a javascript object, using supplied text //////////////////////////////////////////////////////////////////////////////// v8::Handle TRI_CreateErrorObject (int errorNumber, std::string const& message); +//////////////////////////////////////////////////////////////////////////////// +/// @brief creates an error in a javascript object +//////////////////////////////////////////////////////////////////////////////// + +v8::Handle TRI_CreateErrorObject (int errorNumber, std::string const& message, bool autoPrepend); + //////////////////////////////////////////////////////////////////////////////// /// @brief stores the V8 utils function inside the global variable //////////////////////////////////////////////////////////////////////////////// From 4cf6cc6a33482e1fa35e662dde7166770f996d85 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 16 Oct 2012 00:27:02 +0200 Subject: [PATCH 23/28] replaced new/delete with stack objects --- arangod/RestServer/ArangoServer.cpp | 27 ++++++++++------------- lib/Utilities/LineEditor.cpp | 13 +++++++++++- lib/Utilities/LineEditor.h | 33 +++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/arangod/RestServer/ArangoServer.cpp b/arangod/RestServer/ArangoServer.cpp index 5f62f2638e..0cac392fa8 100644 --- a/arangod/RestServer/ArangoServer.cpp +++ b/arangod/RestServer/ArangoServer.cpp @@ -721,7 +721,7 @@ int ArangoServer::executeConsole (OperationMode::server_operation_mode_e mode) { } // ............................................................................. - // run console + // run script // ............................................................................. case OperationMode::MODE_SCRIPT: { @@ -787,15 +787,15 @@ int ArangoServer::executeConsole (OperationMode::server_operation_mode_e mode) { case OperationMode::MODE_CONSOLE: { context->_context->Global()->Set(v8::String::New("DATABASEPATH"), v8::String::New(_databasePath.c_str()), v8::ReadOnly); context->_context->Global()->Set(v8::String::New("VALGRIND"), _runningOnValgrind ? v8::True() : v8::False(), v8::ReadOnly); - V8LineEditor* console = new V8LineEditor(context->_context, ".arango"); + V8LineEditor console(context->_context, ".arango"); - console->open(true); + console.open(true); while (true) { while(! v8::V8::IdleNotification()) { } - char* input = console->prompt("arangod> "); + char* input = console.prompt("arangod> "); if (input == 0) { printf("\n%s\n", TRI_BYE_MESSAGE); @@ -807,7 +807,7 @@ int ArangoServer::executeConsole (OperationMode::server_operation_mode_e mode) { continue; } - console->addHistory(input); + console.addHistory(input); v8::HandleScope scope; v8::TryCatch tryCatch; @@ -819,11 +819,7 @@ int ArangoServer::executeConsole (OperationMode::server_operation_mode_e mode) { cout << TRI_StringifyV8Exception(&tryCatch); } } - - console->close(); - - delete console; - + break; } @@ -962,12 +958,12 @@ int ArangoServer::executeRubyConsole () { // create a line editor printf("ArangoDB MRuby shell [DB version %s]\n", TRIAGENS_VERSION); - MRLineEditor* console = new MRLineEditor(context->_mrb, ".arango-mrb"); + MRLineEditor console(context->_mrb, ".arango-mrb"); - console->open(false); + console.open(false); while (true) { - char* input = console->prompt("arangod> "); + char* input = console.prompt("arangod> "); if (input == 0) { printf("\n" TRI_BYE_MESSAGE "\n"); @@ -979,7 +975,7 @@ int ArangoServer::executeRubyConsole () { continue; } - console->addHistory(input); + console.addHistory(input); struct mrb_parser_state* p = mrb_parse_string(context->_mrb, input, NULL); TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, input); @@ -1011,8 +1007,7 @@ int ArangoServer::executeRubyConsole () { } // close the console - console->close(); - delete console; + console.close(); // close the database closeDatabase(); diff --git a/lib/Utilities/LineEditor.cpp b/lib/Utilities/LineEditor.cpp index a3ccf8c9ec..7c97db743d 100644 --- a/lib/Utilities/LineEditor.cpp +++ b/lib/Utilities/LineEditor.cpp @@ -53,7 +53,8 @@ using namespace std; LineEditor::LineEditor (std::string const& history) : _current(), - _historyFilename(history) { + _historyFilename(history), + _state(STATE_NONE) { rl_initialize(); } @@ -62,6 +63,7 @@ LineEditor::LineEditor (std::string const& history) //////////////////////////////////////////////////////////////////////////////// LineEditor::~LineEditor () { + close(); } //////////////////////////////////////////////////////////////////////////////// @@ -85,6 +87,8 @@ bool LineEditor::open (bool) { using_history(); stifle_history(MAX_HISTORY_ENTRIES); + _state = STATE_OPENED; + return read_history(historyPath().c_str()) == 0; } @@ -93,6 +97,13 @@ bool LineEditor::open (bool) { //////////////////////////////////////////////////////////////////////////////// bool LineEditor::close () { + if (_state != STATE_OPENED) { + // avoid duplicate saving of history + return true; + } + + _state = STATE_CLOSED; + return (write_history(historyPath().c_str()) == 0); } diff --git a/lib/Utilities/LineEditor.h b/lib/Utilities/LineEditor.h index 55a9b93c48..f8d10b068a 100644 --- a/lib/Utilities/LineEditor.h +++ b/lib/Utilities/LineEditor.h @@ -166,6 +166,33 @@ class LineEditor { /// @} //////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- private types +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup LineEditor +/// @{ +//////////////////////////////////////////////////////////////////////////////// + + private: + +//////////////////////////////////////////////////////////////////////////////// +/// @brief state of the console +//////////////////////////////////////////////////////////////////////////////// + + typedef enum { + STATE_NONE = 0, + STATE_OPENED, + STATE_CLOSED, + } + console_state_e; + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + + // ----------------------------------------------------------------------------- // --SECTION-- protected variables // ----------------------------------------------------------------------------- @@ -188,6 +215,12 @@ class LineEditor { //////////////////////////////////////////////////////////////////////////////// std::string _historyFilename; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief current console state +//////////////////////////////////////////////////////////////////////////////// + + console_state_e _state; }; //////////////////////////////////////////////////////////////////////////////// From f78dae4634f66bdb39140f03e7f5177be74f69a9 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 16 Oct 2012 00:29:00 +0200 Subject: [PATCH 24/28] replaced new/delete with stack objects --- arangoirb/MRClient/arangoirb.cpp | 10 +++++----- arangosh/V8Client/arangosh.cpp | 12 +++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/arangoirb/MRClient/arangoirb.cpp b/arangoirb/MRClient/arangoirb.cpp index c19786a6d5..7fe2ae89eb 100644 --- a/arangoirb/MRClient/arangoirb.cpp +++ b/arangoirb/MRClient/arangoirb.cpp @@ -244,12 +244,12 @@ static void InitMRClientConnection (mrb_state* mrb, MRubyClientConnection* conne //////////////////////////////////////////////////////////////////////////////// static void RunShell (mrb_state* mrb) { - MRLineEditor* console = new MRLineEditor(mrb, ".arango-mrb"); + MRLineEditor* console(mrb, ".arango-mrb"); - console->open(false /*! NoAutoComplete*/); + console.open(false /*! NoAutoComplete*/); while (true) { - char* input = console->prompt("arangoirb> "); + char* input = console.prompt("arangoirb> "); if (input == 0) { break; @@ -260,7 +260,7 @@ static void RunShell (mrb_state* mrb) { continue; } - console->addHistory(input); + console.addHistory(input); struct mrb_parser_state* p = mrb_parse_nstring(mrb, input, strlen(input), NULL); TRI_FreeString(TRI_CORE_MEM_ZONE, input); @@ -291,7 +291,7 @@ static void RunShell (mrb_state* mrb) { } } - console->close(); + console.close(); cout << endl; diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index 2ca1a3fc62..6e8e09fee3 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -809,15 +809,15 @@ static void RunShell (v8::Handle context) { v8::Context::Scope contextScope(context); v8::Local name(v8::String::New("(shell)")); - V8LineEditor* console = new V8LineEditor(context, ".arangosh"); + V8LineEditor console(context, ".arangosh"); - console->open(BaseClient.autoComplete()); + console.open(BaseClient.autoComplete()); while (true) { while (! v8::V8::IdleNotification()) { } - char* input = console->prompt("arangosh> "); + char* input = console.prompt("arangosh> "); if (input == 0) { break; @@ -839,7 +839,7 @@ static void RunShell (v8::Handle context) { input = TRI_DuplicateString("help()"); } - console->addHistory(input); + console.addHistory(input); v8::HandleScope scope; v8::TryCatch tryCatch; @@ -856,9 +856,7 @@ static void RunShell (v8::Handle context) { BaseClient.stopPager(); } - console->close(); - - delete console; + console.close(); cout << endl; From 8cad4ff0a8d62fa810956c7bca2a6b2a280f4720 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 16 Oct 2012 10:27:59 +0200 Subject: [PATCH 25/28] suppress excessive log spam --- arangod/VocBase/document-collection.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arangod/VocBase/document-collection.c b/arangod/VocBase/document-collection.c index 049395eba9..481ac753d3 100755 --- a/arangod/VocBase/document-collection.c +++ b/arangod/VocBase/document-collection.c @@ -4634,17 +4634,18 @@ static bool IsExampleMatch (TRI_shaper_t* shaper, } if (result._data.length != example->_data.length) { - LOG_TRACE("expecting length %lu, got length %lu for path %lu", - (unsigned long) result._data.length, - (unsigned long) example->_data.length, - (unsigned long) pids[i]); + // suppress excessive log spam + // LOG_TRACE("expecting length %lu, got length %lu for path %lu", + // (unsigned long) result._data.length, + // (unsigned long) example->_data.length, + // (unsigned long) pids[i]); return false; } if (memcmp(result._data.data, example->_data.data, example->_data.length) != 0) { - LOG_TRACE("data mismatch at path %lu", - (unsigned long) pids[i]); + // suppress excessive log spam + // LOG_TRACE("data mismatch at path %lu", (unsigned long) pids[i]); return false; } } From 29571a2e3a439c2367cf00523203454fca62d188 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 16 Oct 2012 11:33:49 +0200 Subject: [PATCH 26/28] issue #231: handle more client error cases --- lib/HttpServer/HttpCommTask.h | 84 ++++++++++++++++++++++++----------- lib/Rest/HttpRequest.cpp | 14 ++++-- lib/Rest/HttpRequest.h | 4 +- 3 files changed, 69 insertions(+), 33 deletions(-) diff --git a/lib/HttpServer/HttpCommTask.h b/lib/HttpServer/HttpCommTask.h index 1b37b4fe9e..4c48d2aed5 100644 --- a/lib/HttpServer/HttpCommTask.h +++ b/lib/HttpServer/HttpCommTask.h @@ -197,44 +197,31 @@ namespace triagens { case HttpRequest::HTTP_REQUEST_GET: case HttpRequest::HTTP_REQUEST_DELETE: case HttpRequest::HTTP_REQUEST_HEAD: - this->_bodyLength = this->_request->contentLength(); - - if (this->_bodyLength > 0) { - LOGGER_WARNING << "received http GET/DELETE/HEAD request with body length, this should not happen"; - this->_readRequestBody = true; - } - else { - handleRequest = true; - } - break; - case HttpRequest::HTTP_REQUEST_POST: case HttpRequest::HTTP_REQUEST_PUT: - case HttpRequest::HTTP_REQUEST_PATCH: - this->_bodyLength = this->_request->contentLength(); + case HttpRequest::HTTP_REQUEST_PATCH: { + const bool expectContentLength = (this->_requestType == HttpRequest::HTTP_REQUEST_POST || + this->_requestType == HttpRequest::HTTP_REQUEST_PUT || + this->_requestType == HttpRequest::HTTP_REQUEST_DELETE); - if (this->_bodyLength > 0) { - this->_readRequestBody = true; - - if (this->_bodyLength > this->_maximalBodySize) { - LOGGER_WARNING << "maximal body size is " << this->_maximalBodySize << ", request body size is " << this->_bodyLength; - // request entity too large - HttpResponse response(HttpResponse::ENTITY_TOO_LARGE); - this->handleResponse(&response); - return true; - } + if (! checkContentLength(expectContentLength)) { + return true; } - else { + + if (this->_bodyLength == 0) { handleRequest = true; } break; + } - default: + default: { LOGGER_WARNING << "got corrupted HTTP request '" << string(this->_readBuffer->c_str(), (this->_readPosition < 6 ? this->_readPosition : 6)) << "'"; - // bad request - HttpResponse response(HttpResponse::BAD); + // bad request, method not allowed + HttpResponse response(HttpResponse::METHOD_NOT_ALLOWED); this->handleResponse(&response); + return true; + } } // check for a 100-continue @@ -430,6 +417,7 @@ namespace triagens { response->headResponse(response->bodySize()); } + // reserve some outbuffer size const size_t len = response->bodySize() + 128; triagens::basics::StringBuffer* buffer = new triagens::basics::StringBuffer(TRI_UNKNOWN_MEM_ZONE, len); // write header @@ -455,6 +443,48 @@ namespace triagens { this->fillWriteBuffer(); } +//////////////////////////////////////////////////////////////////////////////// +/// check the content-length header of a request and fail it is broken +//////////////////////////////////////////////////////////////////////////////// + + bool checkContentLength (const bool expectContentLength) { + const int64_t bodyLength = this->_request->contentLength(); + + if (bodyLength < 0) { + // bad request, body length is < 0. this is a client error + HttpResponse response(HttpResponse::LENGTH_REQUIRED); + this->handleResponse(&response); + + return false; + } + + if (! expectContentLength && bodyLength > 0) { + // content-length header was sent but the request method does not support that + // we'll warn but read the body anyway + LOGGER_WARNING << "received HTTP GET/DELETE/HEAD request with content-length, this should not happen"; + } + + if ((size_t) bodyLength > this->_maximalBodySize) { + // request entity too large + LOGGER_WARNING << "maximal body size is " << this->_maximalBodySize << ", request body size is " << bodyLength; + HttpResponse response(HttpResponse::ENTITY_TOO_LARGE); + this->handleResponse(&response); + + return false; + } + + // set instance variable to content-length value + this->_bodyLength = (size_t) bodyLength; + if (this->_bodyLength > 0) { + // we'll read the body + this->_readRequestBody = true; + } + + // everything's fine + return true; + } + + //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/Rest/HttpRequest.cpp b/lib/Rest/HttpRequest.cpp index 72af159c83..010a81b8df 100644 --- a/lib/Rest/HttpRequest.cpp +++ b/lib/Rest/HttpRequest.cpp @@ -235,7 +235,7 @@ void HttpRequest::write (TRI_string_buffer_t* buffer) const { } TRI_AppendString2StringBuffer(buffer, "content-length: ", 16); - TRI_AppendUInt64StringBuffer(buffer, _contentLength); + TRI_AppendInt64StringBuffer(buffer, _contentLength); TRI_AppendString2StringBuffer(buffer, "\r\n\r\n", 4); if (_body != 0 && 0 < _bodySize) { @@ -247,7 +247,7 @@ void HttpRequest::write (TRI_string_buffer_t* buffer) const { /// {@inheritDoc} //////////////////////////////////////////////////////////////////////////////// -size_t HttpRequest::contentLength () const { +int64_t HttpRequest::contentLength () const { return _contentLength; } @@ -385,10 +385,15 @@ size_t HttpRequest::bodySize () const { int HttpRequest::setBody (char const* newBody, size_t length) { _body = TRI_DuplicateString2Z(TRI_UNKNOWN_MEM_ZONE, newBody, length); - _contentLength = _bodySize = length; + if (_body == 0) { + return TRI_ERROR_OUT_OF_MEMORY; + } _freeables.push_back(_body); + _contentLength = (int64_t) length; + _bodySize = length; + return TRI_ERROR_NO_ERROR; } @@ -398,7 +403,8 @@ int HttpRequest::setBody (char const* newBody, size_t length) { void HttpRequest::setHeader (char const* key, size_t keyLength, char const* value) { if (keyLength == 14 && memcmp(key, "content-length", keyLength) == 0) { // 14 = strlen("content-length") - _contentLength = TRI_UInt64String(value); + + _contentLength = TRI_Int64String(value); } else { _headers.insert(key, keyLength, value); diff --git a/lib/Rest/HttpRequest.h b/lib/Rest/HttpRequest.h index 92a8c9369d..71f94df759 100644 --- a/lib/Rest/HttpRequest.h +++ b/lib/Rest/HttpRequest.h @@ -289,7 +289,7 @@ namespace triagens { /// @brief returns the content length //////////////////////////////////////////////////////////////////////////////// - size_t contentLength () const; + int64_t contentLength () const; //////////////////////////////////////////////////////////////////////////////// /// @brief returns a header field @@ -519,7 +519,7 @@ namespace triagens { /// @brief content length //////////////////////////////////////////////////////////////////////////////// - size_t _contentLength; + int64_t _contentLength; //////////////////////////////////////////////////////////////////////////////// /// @brief body From 94057c0d0ae96234d68c2b371dc4be115c2444bd Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 16 Oct 2012 13:48:03 +0200 Subject: [PATCH 27/28] sizeof(hash element) /= 2 --- arangod/HashIndex/compare.h | 29 ++++----------- arangod/HashIndex/hasharray.c | 9 +++-- arangod/HashIndex/hasharray.h | 3 +- arangod/HashIndex/hashindex.c | 17 +++++---- arangod/HashIndex/hashindex.h | 6 ++-- arangod/VocBase/index.c | 68 ++++------------------------------- arangod/VocBase/index.h | 9 ----- 7 files changed, 32 insertions(+), 109 deletions(-) diff --git a/arangod/HashIndex/compare.h b/arangod/HashIndex/compare.h index fdc853f508..7bd8a3b628 100755 --- a/arangod/HashIndex/compare.h +++ b/arangod/HashIndex/compare.h @@ -39,16 +39,13 @@ #include #include #include -#include #define USE_STATIC_HASHARRAY_COMPARE 1 #define HASHARRAY_ELEMENT_TYPE(a,b) \ struct a { \ - size_t numFields; \ TRI_shaped_json_t* fields; \ void* data; \ - void* collection; \ } b @@ -90,7 +87,6 @@ static void IndexStaticClearElement(TRI_hasharray_t* array, void* element) { LocalElement_t* hElement = (LocalElement_t*)(element); if (element != NULL) { - hElement->numFields = 0; hElement->fields = 0; hElement->data = 0; } @@ -113,15 +109,14 @@ static bool IndexStaticCopyElementElement (TRI_hasharray_t* array, void* left, v return false; } - leftElement->numFields = rightElement->numFields; leftElement->data = rightElement->data; - leftElement->fields = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_shaped_json_t) * leftElement->numFields, false); + leftElement->fields = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_shaped_json_t) * array->_numFields, false); if (leftElement->fields == NULL) { return false; } - memcpy(leftElement->fields, rightElement->fields, sizeof(TRI_shaped_json_t) * leftElement->numFields); + memcpy(leftElement->fields, rightElement->fields, sizeof(TRI_shaped_json_t) * array->_numFields); return true; } @@ -164,7 +159,7 @@ static uint64_t IndexStaticHashElement (TRI_hasharray_t* array, void* element) { uint64_t hash = TRI_FnvHashBlockInitial(); size_t j; - for (j = 0; j < hElement->numFields; j++) { + for (j = 0; j < array->_numFields; j++) { hash = IndexStaticHashShapedJson(hash, (j + hElement->fields) ); } return hash; @@ -182,7 +177,7 @@ static uint64_t IndexStaticHashKey (TRI_hasharray_t* array, void* element) { uint64_t hash = TRI_FnvHashBlockInitial(); size_t j; - for (j = 0; j < hElement->numFields; j++) { + for (j = 0; j < array->_numFields; j++) { hash = IndexStaticHashShapedJson(hash, (j + hElement->fields) ); } return hash; @@ -228,10 +223,6 @@ static bool IndexStaticIsEqualElementElement (TRI_hasharray_t* array, void* left return false; } - if (hLeftElement->numFields != hRightElement->numFields) { - return false; // should never happen - } - return (hLeftElement->data == hRightElement->data); } @@ -269,11 +260,7 @@ static bool IndexStaticIsEqualKeyElement (TRI_hasharray_t* array, void* leftElem return false; } - if (hLeftElement->numFields != hRightElement->numFields) { - return false; // should never happen - } - - for (j = 0; j < hLeftElement->numFields; j++) { + for (j = 0; j < array->_numFields; j++) { if (!IndexStaticIsEqualShapedJsonShapedJson((j + hLeftElement->fields), (j + hRightElement->fields))) { return false; } @@ -297,11 +284,7 @@ static bool IndexStaticIsEqualKeyElementMulti (TRI_hasharray_t* array, void* lef return false; } - if (hLeftElement->numFields != hRightElement->numFields) { - return false; // should never happen - } - - for (j = 0; j < hLeftElement->numFields; j++) { + for (j = 0; j < array->_numFields; j++) { TRI_shaped_json_t* left = (j + hLeftElement->fields); TRI_shaped_json_t* right = (j + hRightElement->fields); if (!IndexStaticIsEqualShapedJsonShapedJson(left, right)) { diff --git a/arangod/HashIndex/hasharray.c b/arangod/HashIndex/hasharray.c index 20380c601f..6def6b9e95 100755 --- a/arangod/HashIndex/hasharray.c +++ b/arangod/HashIndex/hasharray.c @@ -67,6 +67,7 @@ static bool ResizeHashArrayMulti (TRI_hasharray_t*); //////////////////////////////////////////////////////////////////////////////// bool TRI_InitHashArray (TRI_hasharray_t* array, + size_t numFields, size_t elementSize, uint64_t (*hashKey) (TRI_hasharray_t*, void*), uint64_t (*hashElement) (TRI_hasharray_t*, void*), @@ -78,16 +79,20 @@ bool TRI_InitHashArray (TRI_hasharray_t* array, // ........................................................................... // Assign the callback functions // ........................................................................... + + assert(numFields > 0); array->clearElement = clearElement; array->isEmptyElement = isEmptyElement; array->isEqualKeyElement = isEqualKeyElement; array->isEqualElementElement = isEqualElementElement; - + array->_numFields = numFields; array->_elementSize = elementSize; array->_table = NULL; - array->_nrAlloc = 10; + + // set initial allocation size to 256 elements + array->_nrAlloc = 256; // ........................................................................... diff --git a/arangod/HashIndex/hasharray.h b/arangod/HashIndex/hasharray.h index eff6911caf..6689720dd7 100755 --- a/arangod/HashIndex/hasharray.h +++ b/arangod/HashIndex/hasharray.h @@ -59,7 +59,7 @@ typedef struct TRI_hasharray_s { bool (*isEqualKeyElement) (struct TRI_hasharray_s*, void*, void*); bool (*isEqualElementElement) (struct TRI_hasharray_s*, void*, void*); - + size_t _numFields; // the number of fields indexes uint64_t _elementSize; uint64_t _nrAlloc; // the size of the table uint64_t _nrUsed; // the number of used entries @@ -101,6 +101,7 @@ TRI_hasharray_t; //////////////////////////////////////////////////////////////////////////////// bool TRI_InitHashArray (TRI_hasharray_t*, + size_t numFields, size_t elementSize, uint64_t (*hashKey) (TRI_hasharray_t*, void*), uint64_t (*hashElement) (TRI_hasharray_t*, void*), diff --git a/arangod/HashIndex/hashindex.c b/arangod/HashIndex/hashindex.c index 19b566431f..44b94e1565 100755 --- a/arangod/HashIndex/hashindex.c +++ b/arangod/HashIndex/hashindex.c @@ -100,19 +100,15 @@ void HashIndex_freeResult(TRI_hash_index_elements_t* const list) { FreeResults(list); } - - // ----------------------------------------------------------------------------- // constructors public functions // ----------------------------------------------------------------------------- - //////////////////////////////////////////////////////////////////////////////// /// @brief Creates a new hash array used for storage of elements in the hash index //////////////////////////////////////////////////////////////////////////////// - -HashIndex* HashIndex_new() { +HashIndex* HashIndex_new(size_t numFields) { HashIndex* hashIndex; hashIndex = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(HashIndex), false); @@ -124,18 +120,19 @@ HashIndex* HashIndex_new() { hashIndex->hashArray = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_hasharray_t), false); if (hashIndex->hashArray == NULL) { TRI_Free(TRI_UNKNOWN_MEM_ZONE, hashIndex); + return NULL; } - if (! TRI_InitHashArray(hashIndex->hashArray, sizeof(HashIndexElement), NULL, NULL, NULL, NULL, NULL, NULL) ) { + if (! TRI_InitHashArray(hashIndex->hashArray, numFields, sizeof(HashIndexElement), NULL, NULL, NULL, NULL, NULL, NULL) ) { HashIndex_free(hashIndex); + return NULL; } return hashIndex; } - //////////////////////////////////////////////////////////////////////////////// /// @brief Assigns a static function call to a function pointer used by Query Engine //////////////////////////////////////////////////////////////////////////////// @@ -322,7 +319,7 @@ void MultiHashIndex_freeResult(TRI_hash_index_elements_t* const list) { /// @brief Creates a new multi (non-unique) hash index //////////////////////////////////////////////////////////////////////////////// -HashIndex* MultiHashIndex_new() { +HashIndex* MultiHashIndex_new(size_t numFields) { HashIndex* hashIndex; hashIndex = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(HashIndex), false); @@ -334,11 +331,13 @@ HashIndex* MultiHashIndex_new() { hashIndex->hashArray = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_hasharray_t), false); if (hashIndex->hashArray == NULL) { TRI_Free(TRI_UNKNOWN_MEM_ZONE, hashIndex); + return NULL; } - if (! TRI_InitHashArray(hashIndex->hashArray, sizeof(HashIndexElement), NULL, NULL, NULL, NULL, NULL, NULL) ) { + if (! TRI_InitHashArray(hashIndex->hashArray, numFields, sizeof(HashIndexElement), NULL, NULL, NULL, NULL, NULL, NULL) ) { HashIndex_free(hashIndex); + return NULL; } diff --git a/arangod/HashIndex/hashindex.h b/arangod/HashIndex/hashindex.h index 435827ecef..4f2f00cd0f 100755 --- a/arangod/HashIndex/hashindex.h +++ b/arangod/HashIndex/hashindex.h @@ -60,10 +60,8 @@ typedef struct { typedef struct { - size_t numFields; // the number of fields TRI_shaped_json_t* fields; // list of shaped json objects the blob of data within will be hashed void* data; // master document pointer - void* collection; // currently not used } HashIndexElement; typedef struct { @@ -91,7 +89,7 @@ int HashIndex_assignMethod (void*, TRI_index_method_assignment_type_e); void HashIndex_destroy (HashIndex*); -HashIndex* HashIndex_new (void); +HashIndex* HashIndex_new (size_t); void HashIndex_free (HashIndex*); @@ -128,7 +126,7 @@ void MultiHashIndex_free (HashIndex*); void MultiHashIndex_freeResult(TRI_hash_index_elements_t* const); -HashIndex* MultiHashIndex_new (void); +HashIndex* MultiHashIndex_new (size_t); int MultiHashIndex_add (HashIndex*, HashIndexElement*); diff --git a/arangod/VocBase/index.c b/arangod/VocBase/index.c index 0a18959f46..09cd227046 100755 --- a/arangod/VocBase/index.c +++ b/arangod/VocBase/index.c @@ -1476,8 +1476,7 @@ static int InsertHashIndex (TRI_index_t* idx, TRI_doc_mptr_t const* doc) { // These will be used for hashing. // ............................................................................. - hashElement.numFields = hashIndex->_paths._length; - hashElement.fields = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_shaped_json_t) * hashElement.numFields, false); + hashElement.fields = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_shaped_json_t) * hashIndex->_paths._length, false); res = HashIndexHelper(hashIndex, &hashElement, doc, NULL); @@ -1553,8 +1552,7 @@ static int RemoveHashIndex (TRI_index_t* idx, TRI_doc_mptr_t const* doc) { // Allocate some memory for the HashIndexElement structure // ............................................................................. - hashElement.numFields = hashIndex->_paths._length; - hashElement.fields = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_shaped_json_t) * hashElement.numFields, false); + hashElement.fields = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_shaped_json_t) * hashIndex->_paths._length, false); // ............................................................................. // Fill the json field list from the document @@ -1648,8 +1646,7 @@ static int UpdateHashIndex (TRI_index_t* idx, // Allocate some memory for the HashIndexElement structure // ............................................................................. - hashElement.numFields = hashIndex->_paths._length; - hashElement.fields = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_shaped_json_t) * hashElement.numFields, false); + hashElement.fields = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_shaped_json_t) * hashIndex->_paths._length, false); // ............................................................................. // Update for unique hash index @@ -1817,10 +1814,10 @@ TRI_index_t* TRI_CreateHashIndex (struct TRI_primary_collection_s* collection, } if (unique) { - hashIndex->_hashIndex = HashIndex_new(); + hashIndex->_hashIndex = HashIndex_new(hashIndex->_paths._length); } else { - hashIndex->_hashIndex = MultiHashIndex_new(); + hashIndex->_hashIndex = MultiHashIndex_new(hashIndex->_paths._length); } if (hashIndex->_hashIndex == NULL) { // oops out of memory? @@ -1906,56 +1903,6 @@ void TRI_FreeResultHashIndex (const TRI_index_t* const idx, } } -//////////////////////////////////////////////////////////////////////////////// -/// @brief locates entries in the hash index given a JSON list -/// -/// @warning who ever calls this function is responsible for destroying -/// TRI_hash_index_elements_t* results -//////////////////////////////////////////////////////////////////////////////// - -TRI_hash_index_elements_t* TRI_LookupJsonHashIndex (TRI_index_t* idx, TRI_json_t* values) { - TRI_hash_index_t* hashIndex; - TRI_hash_index_elements_t* result; - HashIndexElement element; - TRI_shaper_t* shaper; - size_t j; - - element.numFields = values->_value._objects._length; - element.fields = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_shaped_json_t) * element.numFields, false); - - if (element.fields == NULL) { - TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY); - LOG_WARNING("out-of-memory in LookupJsonHashIndex"); - return NULL; - } - - hashIndex = (TRI_hash_index_t*) idx; - shaper = hashIndex->base._collection->_shaper; - - for (j = 0; j < element.numFields; ++j) { - TRI_json_t* jsonObject = (TRI_json_t*) (TRI_AtVector(&(values->_value._objects), j)); - TRI_shaped_json_t* shapedObject = TRI_ShapedJsonJson(shaper, jsonObject); - - element.fields[j] = *shapedObject; - TRI_Free(TRI_UNKNOWN_MEM_ZONE, shapedObject); - } - - if (hashIndex->base._unique) { - result = HashIndex_find(hashIndex->_hashIndex, &element); - } - else { - result = MultiHashIndex_find(hashIndex->_hashIndex, &element); - } - - for (j = 0; j < element.numFields; ++j) { - TRI_DestroyShapedJson(shaper, element.fields + j); - } - - TRI_Free(TRI_UNKNOWN_MEM_ZONE, element.fields); - - return result; -} - //////////////////////////////////////////////////////////////////////////////// /// @brief locates entries in the hash index given shaped json objects //////////////////////////////////////////////////////////////////////////////// @@ -1968,8 +1915,7 @@ TRI_hash_index_elements_t* TRI_LookupShapedJsonHashIndex (TRI_index_t* idx, TRI_ hashIndex = (TRI_hash_index_t*) idx; - element.numFields = hashIndex->_paths._length; - element.fields = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_shaped_json_t) * element.numFields, false); + element.fields = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_shaped_json_t) * hashIndex->_paths._length, false); if (element.fields == NULL) { TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY); @@ -1977,7 +1923,7 @@ TRI_hash_index_elements_t* TRI_LookupShapedJsonHashIndex (TRI_index_t* idx, TRI_ return NULL; } - for (j = 0; j < element.numFields; ++j) { + for (j = 0; j < hashIndex->_paths._length; ++j) { element.fields[j] = *values[j]; } diff --git a/arangod/VocBase/index.h b/arangod/VocBase/index.h index 42cec4dba6..2ca12adcc0 100755 --- a/arangod/VocBase/index.h +++ b/arangod/VocBase/index.h @@ -510,15 +510,6 @@ void TRI_FreeHashIndex (TRI_index_t* idx); void TRI_FreeResultHashIndex (const TRI_index_t* const, TRI_hash_index_elements_t* const); -//////////////////////////////////////////////////////////////////////////////// -/// @brief locates entries in the hash index given a JSON list -/// -/// @warning who ever calls this function is responsible for destroying -/// TRI_hash_index_elements_t* results -//////////////////////////////////////////////////////////////////////////////// - -TRI_hash_index_elements_t* TRI_LookupJsonHashIndex (TRI_index_t*, TRI_json_t*); - //////////////////////////////////////////////////////////////////////////////// /// @brief locates entries in the hash index given shaped json objects /// From 3545ed527c4698061ec3eba270cc8795677a35fc Mon Sep 17 00:00:00 2001 From: a-brandt Date: Tue, 16 Oct 2012 15:05:17 +0200 Subject: [PATCH 28/28] added "make setup" --- Installation/build.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Installation/build.sh b/Installation/build.sh index 3403db52b3..29ca74d7d0 100755 --- a/Installation/build.sh +++ b/Installation/build.sh @@ -67,22 +67,15 @@ case $TRI_OS_LONG in ;; Linux-openSUSE-12*) - echo "Using configuration for openSuSE 12" - OPTIONS="$OPTIONS --enable-flex --enable-bison --enable-all-in-one --enable-mruby --disable-all-in-one-icu --enable-icu " - LDD_INFO="yes" - RESULTS="$RESULTS arangoirb" - ;; - - Linux-openSUSE-11.4*) - echo "Using configuration for openSuSE 11.4" - OPTIONS="$OPTIONS --enable-all-in-one --enable-mruby" + echo "Using configuration for openSuSE 12.X" + OPTIONS="$OPTIONS --enable-flex --enable-bison --enable-mruby " LDD_INFO="yes" RESULTS="$RESULTS arangoirb" ;; Linux-openSUSE-11*) - echo "Using configuration for openSuSE 11" - OPTIONS="$OPTIONS --enable-all-in-one --enable-mruby" + echo "Using configuration for openSuSE 11.X" + OPTIONS="$OPTIONS --enable-mruby" LDD_INFO="yes" RESULTS="$RESULTS arangoirb" ;; @@ -135,6 +128,17 @@ case $TRI_OS_LONG in esac +if [ ! -f configure ] ; then +echo "########################################################" +echo "create configure script:" +echo " make setup" +echo "########################################################" +echo + +make setup || exit 1 +fi + + echo echo "########################################################" echo "CPPFLAGS: $CPPFLAGS"