mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
9e42ec4409
|
@ -238,6 +238,9 @@ v2.0.0-rc1 (2014-02-28)
|
|||
v1.4.13 (XXXX-XX-XX)
|
||||
--------------------
|
||||
|
||||
* allow startup options `temp-path` and `default-language` to be specified from the arangod
|
||||
configuration file and not only from the command line
|
||||
|
||||
* fixed too eager compaction
|
||||
|
||||
The compaction will now wait for several seconds before trying to re-compact the same
|
||||
|
|
|
@ -857,7 +857,9 @@ unittests-arangob:
|
|||
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 10000 --concurrency 2 --test version --async true || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 20000 --concurrency 1 --test version --async true || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100000 --concurrency 2 --test shapes --batch-size 16 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100000 --concurrency 2 --test shapes --batch-size 16 --complexity 2 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100000 --concurrency 2 --test shapes-append --batch-size 16 --complexity 4 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100000 --concurrency 2 --test random-shapes --batch-size 16 --complexity 2 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 1000 --batch-size 16 --concurrency 2 --test version || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100 --batch-size 0 --concurrency 1 --test version || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100 --batch-size 10 --concurrency 2 --test document --complexity 1 || test "x$(FORCE)" == "x1"
|
||||
|
|
|
@ -451,8 +451,8 @@ int removeElementMasterTable(MasterTable_t* mt, TRI_master_table_position_t* pos
|
|||
block->_free = block->_free | tempInt;
|
||||
equality = false;
|
||||
vectorInsertPos = compareIndexOf(mt, position->_blockNum, &equality);
|
||||
if (!equality) {
|
||||
TRI_InsertVector(&(mt->_freeBlockPosition), &(position->_blockNum), vectorInsertPos);
|
||||
if (! equality) {
|
||||
return TRI_InsertVector(&(mt->_freeBlockPosition), &(position->_blockNum), vectorInsertPos);
|
||||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
|
|
@ -469,10 +469,15 @@ void ArangoServer::buildApplicationServer () {
|
|||
// define server options
|
||||
// .............................................................................
|
||||
|
||||
// command-line only options
|
||||
additional[ApplicationServer::OPTIONS_CMDLINE]
|
||||
("console", "do not start as server, start a JavaScript emergency console instead")
|
||||
("temp-path", &_tempPath, "temporary path")
|
||||
("upgrade", "perform a database upgrade")
|
||||
;
|
||||
|
||||
// other options
|
||||
additional[ApplicationServer::OPTIONS_SERVER]
|
||||
("temp-path", &_tempPath, "temporary path")
|
||||
("default-language", &_defaultLanguage, "ISO-639 language code")
|
||||
;
|
||||
|
||||
|
|
|
@ -1209,7 +1209,9 @@ int TRI_WriteElementDatafile (TRI_datafile_t* datafile,
|
|||
|
||||
if (type != TRI_DF_MARKER_HEADER &&
|
||||
type != TRI_DF_MARKER_FOOTER &&
|
||||
type != TRI_COL_MARKER_HEADER) {
|
||||
type != TRI_COL_MARKER_HEADER &&
|
||||
type != TRI_DF_MARKER_ATTRIBUTE &&
|
||||
type != TRI_DF_MARKER_SHAPE) {
|
||||
|
||||
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
||||
// check _tick value of marker and set min/max tick values for datafile
|
||||
|
|
|
@ -318,7 +318,7 @@ static void SetAttributeWeight (voc_shaper_t* shaper,
|
|||
return;
|
||||
}
|
||||
|
||||
TRI_InsertVectorPointer(&(shaper->_sortedAttributes), item, *searchResult);
|
||||
TRI_InsertVectorPointer(&(shaper->_sortedAttributes), item, (size_t) (*searchResult));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "Basics/StringUtils.h"
|
||||
#include "BasicsC/init.h"
|
||||
#include "BasicsC/logging.h"
|
||||
#include "BasicsC/random.h"
|
||||
#include "BasicsC/tri-strings.h"
|
||||
#include "BasicsC/string-buffer.h"
|
||||
#include "BasicsC/terminal-utils.h"
|
||||
|
|
|
@ -256,11 +256,10 @@ struct ShapesTest : public BenchmarkOperation {
|
|||
}
|
||||
TRI_AppendStringStringBuffer(buffer, ",\"value");
|
||||
TRI_AppendUInt64StringBuffer(buffer, (uint64_t) ((globalCounter + i) % mod));
|
||||
TRI_AppendStringStringBuffer(buffer, "\":\"");
|
||||
TRI_AppendStringStringBuffer(buffer, "some bogus string value to fill up the datafile...");
|
||||
TRI_AppendStringStringBuffer(buffer, "\":\"some bogus string value to fill up the datafile...\"");
|
||||
}
|
||||
|
||||
TRI_AppendStringStringBuffer(buffer, "\"}");
|
||||
TRI_AppendStringStringBuffer(buffer, "}");
|
||||
|
||||
*length = TRI_LengthStringBuffer(buffer);
|
||||
*mustFree = true;
|
||||
|
@ -278,6 +277,191 @@ struct ShapesTest : public BenchmarkOperation {
|
|||
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- shapes append test
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct ShapesAppendTest : public BenchmarkOperation {
|
||||
ShapesAppendTest ()
|
||||
: BenchmarkOperation () {
|
||||
}
|
||||
|
||||
~ShapesAppendTest () {
|
||||
}
|
||||
|
||||
bool setUp (SimpleHttpClient* client) {
|
||||
return DeleteCollection(client, Collection) &&
|
||||
CreateCollection(client, Collection, 2);
|
||||
}
|
||||
|
||||
void tearDown () {
|
||||
}
|
||||
|
||||
string url (const int threadNumber, const size_t threadCounter, const size_t globalCounter) {
|
||||
const size_t mod = globalCounter % 2;
|
||||
|
||||
if (mod == 0) {
|
||||
return string("/_api/document?collection=" + Collection);
|
||||
}
|
||||
else {
|
||||
size_t keyId = (size_t) (globalCounter / 2);
|
||||
const string key = "testkey" + StringUtils::itoa(keyId);
|
||||
|
||||
return string("/_api/document/" + Collection + "/" + key);
|
||||
}
|
||||
}
|
||||
|
||||
HttpRequest::HttpRequestType type (const int threadNumber, const size_t threadCounter, const size_t globalCounter) {
|
||||
const size_t mod = globalCounter % 2;
|
||||
|
||||
if (mod == 0) {
|
||||
return HttpRequest::HTTP_REQUEST_POST;
|
||||
}
|
||||
return HttpRequest::HTTP_REQUEST_GET;
|
||||
}
|
||||
|
||||
const char* payload (size_t* length, const int threadNumber, const size_t threadCounter, const size_t globalCounter, bool* mustFree) {
|
||||
const size_t mod = globalCounter % 2;
|
||||
|
||||
if (mod == 0) {
|
||||
const uint64_t n = Complexity;
|
||||
TRI_string_buffer_t* buffer;
|
||||
|
||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||
TRI_AppendStringStringBuffer(buffer, "{\"_key\":\"");
|
||||
|
||||
size_t keyId = (size_t) (globalCounter / 2);
|
||||
const string key = "testkey" + StringUtils::itoa(keyId);
|
||||
TRI_AppendString2StringBuffer(buffer, key.c_str(), key.size());
|
||||
TRI_AppendStringStringBuffer(buffer, "\"");
|
||||
|
||||
for (uint64_t i = 1; i <= n; ++i) {
|
||||
uint64_t mod = Operations / 10;
|
||||
if (mod < 100) {
|
||||
mod = 100;
|
||||
}
|
||||
TRI_AppendStringStringBuffer(buffer, ",\"value");
|
||||
TRI_AppendUInt64StringBuffer(buffer, (uint64_t) ((globalCounter + i) % mod));
|
||||
TRI_AppendStringStringBuffer(buffer, "\":\"some bogus string value to fill up the datafile...\"");
|
||||
}
|
||||
|
||||
TRI_AppendStringStringBuffer(buffer, "}");
|
||||
|
||||
*length = TRI_LengthStringBuffer(buffer);
|
||||
*mustFree = true;
|
||||
char* ptr = TRI_StealStringBuffer(buffer);
|
||||
TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, buffer);
|
||||
|
||||
return (const char*) ptr;
|
||||
}
|
||||
else {
|
||||
*length = 0;
|
||||
*mustFree = false;
|
||||
return (const char*) 0;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- random shapes test
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct RandomShapesTest : public BenchmarkOperation {
|
||||
RandomShapesTest ()
|
||||
: BenchmarkOperation () {
|
||||
_randomValue = TRI_UInt32Random();
|
||||
}
|
||||
|
||||
~RandomShapesTest () {
|
||||
}
|
||||
|
||||
bool setUp (SimpleHttpClient* client) {
|
||||
return DeleteCollection(client, Collection) &&
|
||||
CreateCollection(client, Collection, 2);
|
||||
}
|
||||
|
||||
void tearDown () {
|
||||
}
|
||||
|
||||
string url (const int threadNumber, const size_t threadCounter, const size_t globalCounter) {
|
||||
const size_t mod = globalCounter % 3;
|
||||
|
||||
if (mod == 0) {
|
||||
return string("/_api/document?collection=" + Collection);
|
||||
}
|
||||
else {
|
||||
size_t keyId = (size_t) (globalCounter / 3);
|
||||
const string key = "testkey" + StringUtils::itoa(keyId);
|
||||
|
||||
return string("/_api/document/" + Collection + "/" + key);
|
||||
}
|
||||
}
|
||||
|
||||
HttpRequest::HttpRequestType type (const int threadNumber, const size_t threadCounter, const size_t globalCounter) {
|
||||
const size_t mod = globalCounter % 3;
|
||||
|
||||
if (mod == 0) {
|
||||
return HttpRequest::HTTP_REQUEST_POST;
|
||||
}
|
||||
else if (mod == 1) {
|
||||
return HttpRequest::HTTP_REQUEST_GET;
|
||||
}
|
||||
else {
|
||||
return HttpRequest::HTTP_REQUEST_DELETE;
|
||||
}
|
||||
}
|
||||
|
||||
const char* payload (size_t* length, const int threadNumber, const size_t threadCounter, const size_t globalCounter, bool* mustFree) {
|
||||
const size_t mod = globalCounter % 3;
|
||||
|
||||
if (mod == 0) {
|
||||
const uint64_t n = Complexity;
|
||||
TRI_string_buffer_t* buffer;
|
||||
|
||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||
TRI_AppendStringStringBuffer(buffer, "{\"_key\":\"");
|
||||
|
||||
size_t keyId = (size_t) (globalCounter / 3);
|
||||
const string key = "testkey" + StringUtils::itoa(keyId);
|
||||
TRI_AppendString2StringBuffer(buffer, key.c_str(), key.size());
|
||||
TRI_AppendStringStringBuffer(buffer, "\"");
|
||||
|
||||
uint32_t const t = _randomValue % (uint32_t) (globalCounter + threadNumber + 1);
|
||||
|
||||
for (uint64_t i = 1; i <= n; ++i) {
|
||||
TRI_AppendStringStringBuffer(buffer, ",\"value");
|
||||
TRI_AppendUInt64StringBuffer(buffer, (uint64_t) (globalCounter + i));
|
||||
if (t % 3 == 0) {
|
||||
TRI_AppendStringStringBuffer(buffer, "\":true");
|
||||
}
|
||||
else if (t % 3 == 1) {
|
||||
TRI_AppendStringStringBuffer(buffer, "\":null");
|
||||
}
|
||||
else
|
||||
TRI_AppendStringStringBuffer(buffer, "\":\"some bogus string value to fill up the datafile...\"");
|
||||
}
|
||||
|
||||
TRI_AppendStringStringBuffer(buffer, "}");
|
||||
|
||||
*length = TRI_LengthStringBuffer(buffer);
|
||||
*mustFree = true;
|
||||
char* ptr = TRI_StealStringBuffer(buffer);
|
||||
TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, buffer);
|
||||
|
||||
return (const char*) ptr;
|
||||
}
|
||||
else {
|
||||
*length = 0;
|
||||
*mustFree = false;
|
||||
return (const char*) 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t _randomValue;
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- document CRUD test
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -1201,6 +1385,12 @@ static BenchmarkOperation* GetTestCase (const string& name) {
|
|||
if (name == "shapes") {
|
||||
return new ShapesTest();
|
||||
}
|
||||
if (name == "shapes-append") {
|
||||
return new ShapesAppendTest();
|
||||
}
|
||||
if (name == "random-shapes") {
|
||||
return new RandomShapesTest();
|
||||
}
|
||||
if (name == "crud") {
|
||||
return new DocumentCrudTest();
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<script id="collectionsItemView.ejs" type="text/template">
|
||||
<div class="iconSet">
|
||||
<span id="editCollection" class="icon_arangodb_settings2" alt="Edit collection properties" title="Edit collection properties"></span>
|
||||
<% if(attributes.status === "loaded") { %>
|
||||
<span id="editCollection_<%=model.get('name')%>" class="icon_arangodb_settings2" alt="Edit collection properties" title="Edit collection properties"></span>
|
||||
<% if(model.get('status') === "loaded") { %>
|
||||
<span class="spanInfo icon_arangodb_info" title="Show collection properties"></span>
|
||||
<%} else {%>
|
||||
<span class="icon_arangodb_info disabled" alt="disabled"></span>
|
||||
<%}%>
|
||||
</div>
|
||||
|
||||
<img src="<%= attributes.picture %>" height="50" width="50" alt="" class="icon">
|
||||
<img src="<%= model.get('picture') %>" height="50" width="50" alt="" class="icon">
|
||||
<div class="tileBadge">
|
||||
<span>
|
||||
<div class="corneredBadge <%= attributes.status %>">
|
||||
<%= attributes.status %>
|
||||
<div class="corneredBadge <%= model.get('status') %>">
|
||||
<%= model.get('status') %>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<h5 class="collectionName"><%= attributes.name %></h5>
|
||||
<h5 class="collectionName"><%= model.get('name') %></h5>
|
||||
</script>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
return this;
|
||||
},
|
||||
events: {
|
||||
"click #save-modified-collection" : "saveModifiedCollection(true)",
|
||||
"click #save-modified-collection" : "saveModifiedCollection",
|
||||
"hidden #change-collection" : "hidden",
|
||||
"click #delete-modified-collection" : "deleteCollection",
|
||||
"click #load-modified-collection" : "loadCollection",
|
||||
|
@ -36,7 +36,7 @@
|
|||
},
|
||||
listenKey: function(e) {
|
||||
if (e.keyCode === 13) {
|
||||
this.saveModifiedCollection(true);
|
||||
this.saveModifiedCollection();
|
||||
}
|
||||
},
|
||||
hidden: function () {
|
||||
|
@ -97,11 +97,7 @@
|
|||
$('#change-collection-size').val(calculatedSize);
|
||||
$('#change-collection').modal('show');
|
||||
},
|
||||
saveModifiedCollection: function(run) {
|
||||
|
||||
if (run !== true) {
|
||||
return 0;
|
||||
}
|
||||
saveModifiedCollection: function() {
|
||||
|
||||
var newname = $('#change-collection-name').val();
|
||||
if (newname === '') {
|
||||
|
|
|
@ -17,12 +17,15 @@
|
|||
},
|
||||
events: {
|
||||
'click .pull-left' : 'noop',
|
||||
'click #editCollection' : 'editProperties',
|
||||
'click .icon_arangodb_settings2' : 'editProperties',
|
||||
// 'click #editCollection' : 'editProperties',
|
||||
'click .spanInfo' : 'showProperties',
|
||||
'click': 'selectCollection'
|
||||
},
|
||||
render: function () {
|
||||
$(this.el).html(this.template.render(this.model));
|
||||
$(this.el).html(this.template.render({
|
||||
model: this.model
|
||||
}));
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
|
@ -756,7 +756,9 @@ testFuncs.dump = function (options) {
|
|||
var benchTodo = [
|
||||
["--requests","10000","--concurrency","2","--test","version", "--async","true"],
|
||||
["--requests","20000","--concurrency","1","--test","version", "--async","true"],
|
||||
["--requests","100000","--concurrency","2","--test","shapes", "--batch-size","16"],
|
||||
["--requests","100000","--concurrency","2","--test","shapes", "--batch-size","16", "--complexity","2"],
|
||||
["--requests","100000","--concurrency","2","--test","shapes-append", "--batch-size","16", "--complexity","4"],
|
||||
["--requests","100000","--concurrency","2","--test","random-shapes", "--batch-size","16", "--complexity","2"],
|
||||
["--requests","1000","--concurrency","2","--test","version", "--batch-size", "16"],
|
||||
["--requests","100","--concurrency","1","--test","version", "--batch-size", "0"],
|
||||
["--requests","100","--concurrency","2","--test","document", "--batch-size",
|
||||
|
|
|
@ -339,30 +339,30 @@ void* TRI_AtVector (TRI_vector_t const* vector, size_t pos) {
|
|||
return (void*) (vector->_buffer + pos * vector->_elementSize);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief inserts an element at a given position
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InsertVector (TRI_vector_t* vector, void const* element, size_t position) {
|
||||
int TRI_InsertVector (TRI_vector_t* vector, void const* element, size_t n) {
|
||||
char* newBuffer;
|
||||
|
||||
// ...........................................................................
|
||||
// Check and see if we need to extend the vector
|
||||
// ...........................................................................
|
||||
|
||||
if (vector->_length >= vector->_capacity || position >= vector->_length) {
|
||||
if (vector->_length >= vector->_capacity || n >= vector->_capacity) {
|
||||
size_t newSize = (size_t) (1 + (GROW_FACTOR * vector->_capacity));
|
||||
|
||||
if (position >= newSize) {
|
||||
newSize = position + 1;
|
||||
if (n >= newSize) {
|
||||
newSize = n + 1;
|
||||
}
|
||||
|
||||
assert(newSize > n);
|
||||
|
||||
newBuffer = (char*) TRI_Allocate(vector->_memoryZone, newSize * vector->_elementSize, false);
|
||||
|
||||
if (newBuffer == NULL) {
|
||||
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
vector->_capacity = newSize;
|
||||
|
@ -375,20 +375,21 @@ void TRI_InsertVector (TRI_vector_t* vector, void const* element, size_t positio
|
|||
vector->_buffer = newBuffer;
|
||||
}
|
||||
|
||||
if (position < vector->_length) {
|
||||
memmove(vector->_buffer + (vector->_elementSize * (position + 1)),
|
||||
vector->_buffer + (vector->_elementSize * position),
|
||||
vector->_elementSize * (vector->_length - position)
|
||||
if (n < vector->_length) {
|
||||
memmove(vector->_buffer + (vector->_elementSize * (n + 1)),
|
||||
vector->_buffer + (vector->_elementSize * n),
|
||||
vector->_elementSize * (vector->_length - n)
|
||||
);
|
||||
vector->_length += 1;
|
||||
}
|
||||
else {
|
||||
vector->_length = position + 1;
|
||||
vector->_length = n + 1;
|
||||
}
|
||||
|
||||
memcpy(vector->_buffer + (vector->_elementSize * position), element, vector->_elementSize);
|
||||
}
|
||||
memcpy(vector->_buffer + (vector->_elementSize * n), element, vector->_elementSize);
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets an element at a given position
|
||||
|
@ -690,12 +691,11 @@ int TRI_PushBackVectorPointer (TRI_vector_pointer_t* vector, void* element) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_InsertVectorPointer (TRI_vector_pointer_t* vector, void* element, size_t n) {
|
||||
|
||||
// ...........................................................................
|
||||
// Check and see if we need to extend the vector
|
||||
// ...........................................................................
|
||||
|
||||
if (vector->_length >= vector->_capacity || n >= vector->_length) {
|
||||
if (vector->_length >= vector->_capacity || n >= vector->_capacity) {
|
||||
void* newBuffer;
|
||||
size_t newSize = (size_t) (1 + GROW_FACTOR * vector->_capacity);
|
||||
|
||||
|
@ -703,6 +703,8 @@ int TRI_InsertVectorPointer (TRI_vector_pointer_t* vector, void* element, size_t
|
|||
newSize = n + 1;
|
||||
}
|
||||
|
||||
assert(newSize > n);
|
||||
|
||||
newBuffer = TRI_Reallocate(vector->_memoryZone, vector->_buffer, newSize * sizeof(void*));
|
||||
|
||||
if (newBuffer == NULL) {
|
||||
|
@ -721,6 +723,8 @@ int TRI_InsertVectorPointer (TRI_vector_pointer_t* vector, void* element, size_t
|
|||
sizeof(void*) * (vector->_length - n));
|
||||
}
|
||||
|
||||
assert(vector->_capacity >= vector->_length);
|
||||
|
||||
vector->_buffer[n] = element;
|
||||
|
||||
if (n > vector->_length) {
|
||||
|
@ -1081,18 +1085,19 @@ int TRI_PushBackVectorString (TRI_vector_string_t* vector, char* element) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_InsertVectorString (TRI_vector_string_t* vector, char* element, size_t n) {
|
||||
|
||||
// ...........................................................................
|
||||
// Check and see if we need to extend the vector
|
||||
// ...........................................................................
|
||||
|
||||
if (n >= vector->_capacity || n >= vector->_length) {
|
||||
if (n >= vector->_capacity || n >= vector->_capacity) {
|
||||
char** newBuffer;
|
||||
size_t newSize = (size_t) (1 + GROW_FACTOR * vector->_capacity);
|
||||
|
||||
if (n >= newSize) {
|
||||
newSize = n + 1;
|
||||
}
|
||||
|
||||
assert(newSize > n);
|
||||
|
||||
newBuffer = (char**) TRI_Reallocate(vector->_memoryZone, vector->_buffer, newSize * sizeof(char*));
|
||||
|
||||
|
@ -1109,6 +1114,8 @@ int TRI_InsertVectorString (TRI_vector_string_t* vector, char* element, size_t n
|
|||
vector->_buffer + n,
|
||||
sizeof(char**) * (vector->_length - n));
|
||||
}
|
||||
|
||||
assert(vector->_capacity >= vector->_length);
|
||||
|
||||
vector->_length++;
|
||||
vector->_buffer[n] = element;
|
||||
|
|
|
@ -180,7 +180,7 @@ void* TRI_AtVector (TRI_vector_t const*, size_t);
|
|||
/// @brief inserts an element at a given position
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InsertVector (TRI_vector_t* vector, void const* element, size_t position);
|
||||
int TRI_InsertVector (TRI_vector_t* vector, void const* element, size_t position);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets an element at a given position
|
||||
|
|
|
@ -218,7 +218,7 @@ static bool LoadJavaScriptDirectory (char const* path,
|
|||
|
||||
filename = files._buffer[i];
|
||||
|
||||
if (! regexec(&re, filename, 0, 0, 0) == 0) {
|
||||
if (regexec(&re, filename, 0, 0, 0) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue