mirror of https://gitee.com/bigwinds/arangodb
remove structures.h (only needed by json.h)
This commit is contained in:
parent
31bbbb454f
commit
757085fbe4
|
@ -165,7 +165,6 @@ typedef long suseconds_t;
|
|||
#include "Basics/debugging.h"
|
||||
#include "Basics/make_unique.h"
|
||||
#include "Basics/memory.h"
|
||||
#include "Basics/structures.h"
|
||||
#include "Basics/system-compiler.h"
|
||||
#include "Basics/system-functions.h"
|
||||
#undef TRI_WITHIN_COMMON
|
||||
|
|
|
@ -27,6 +27,61 @@
|
|||
#include "Basics/StringBuffer.h"
|
||||
#include "Basics/tri-strings.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destroys the data of blob, but does not free the pointer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_DestroyBlob(TRI_memory_zone_t* zone, TRI_blob_t* blob) {
|
||||
if (blob != nullptr) {
|
||||
if (blob->data != nullptr) {
|
||||
TRI_Free(zone, blob->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief copies a blob into given destination
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_CopyToBlob(TRI_memory_zone_t* zone, TRI_blob_t* dst,
|
||||
TRI_blob_t const* src) {
|
||||
dst->length = src->length;
|
||||
|
||||
if (src->length == 0 || src->data == nullptr) {
|
||||
dst->length = 0;
|
||||
dst->data = nullptr;
|
||||
} else {
|
||||
dst->data = static_cast<char*>(TRI_Allocate(zone, dst->length, false));
|
||||
|
||||
if (dst->data == nullptr) {
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(dst->data, src->data, src->length);
|
||||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief assigns a blob value by reference into given destination
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_AssignToBlob(TRI_memory_zone_t* zone, TRI_blob_t* dst,
|
||||
TRI_blob_t const* src) {
|
||||
dst->length = src->length;
|
||||
|
||||
if (src->length == 0 || src->data == nullptr) {
|
||||
dst->length = 0;
|
||||
dst->data = nullptr;
|
||||
} else {
|
||||
dst->length = src->length;
|
||||
dst->data = src->data;
|
||||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief prints a json object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -29,6 +29,37 @@
|
|||
|
||||
struct TRI_string_buffer_t;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief global blob type
|
||||
///
|
||||
/// A blob contains a length and data. The size of the blob is limited to
|
||||
/// 4 GByte.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct TRI_blob_t {
|
||||
char* data;
|
||||
uint32_t length;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destorys the data of blob, but does not free the pointer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_DestroyBlob(TRI_memory_zone_t*, TRI_blob_t*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief copies a blob into given destination
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_CopyToBlob(TRI_memory_zone_t*, TRI_blob_t* dst, TRI_blob_t const* src);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief assigns a blob value by reference into given destination
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_AssignToBlob(TRI_memory_zone_t* zone, TRI_blob_t* dst,
|
||||
TRI_blob_t const* src);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief json type
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
||||
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Dr. Frank Celler
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Basics/Common.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destroys the data of blob, but does not free the pointer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_DestroyBlob(TRI_memory_zone_t* zone, TRI_blob_t* blob) {
|
||||
if (blob != nullptr) {
|
||||
if (blob->data != nullptr) {
|
||||
TRI_Free(zone, blob->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief copies a blob into given destination
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_CopyToBlob(TRI_memory_zone_t* zone, TRI_blob_t* dst,
|
||||
TRI_blob_t const* src) {
|
||||
dst->length = src->length;
|
||||
|
||||
if (src->length == 0 || src->data == nullptr) {
|
||||
dst->length = 0;
|
||||
dst->data = nullptr;
|
||||
} else {
|
||||
dst->data = static_cast<char*>(TRI_Allocate(zone, dst->length, false));
|
||||
|
||||
if (dst->data == nullptr) {
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(dst->data, src->data, src->length);
|
||||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief assigns a blob value by reference into given destination
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_AssignToBlob(TRI_memory_zone_t* zone, TRI_blob_t* dst,
|
||||
TRI_blob_t const* src) {
|
||||
dst->length = src->length;
|
||||
|
||||
if (src->length == 0 || src->data == nullptr) {
|
||||
dst->length = 0;
|
||||
dst->data = nullptr;
|
||||
} else {
|
||||
dst->length = src->length;
|
||||
dst->data = src->data;
|
||||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
||||
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Dr. Frank Celler
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGODB_BASICS_STRUCTURES_H
|
||||
#define ARANGODB_BASICS_STRUCTURES_H 1
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief global blob type
|
||||
///
|
||||
/// A blob contains a length and data. The size of the blob is limited to
|
||||
/// 4 GByte.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct TRI_blob_t {
|
||||
char* data;
|
||||
uint32_t length;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destorys the data of blob, but does not free the pointer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_DestroyBlob(TRI_memory_zone_t*, TRI_blob_t*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief copies a blob into given destination
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_CopyToBlob(TRI_memory_zone_t*, TRI_blob_t* dst, TRI_blob_t const* src);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief assigns a blob value by reference into given destination
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_AssignToBlob(TRI_memory_zone_t* zone, TRI_blob_t* dst,
|
||||
TRI_blob_t const* src);
|
||||
|
||||
#endif
|
|
@ -165,7 +165,6 @@ add_library(${LIB_ARANGO} STATIC
|
|||
Basics/prime-numbers.cpp
|
||||
Basics/process-utils.cpp
|
||||
Basics/socket-utils.cpp
|
||||
Basics/structures.cpp
|
||||
Basics/system-functions.cpp
|
||||
Basics/terminal-utils.cpp
|
||||
Basics/tri-strings.cpp
|
||||
|
|
Loading…
Reference in New Issue