Skip to content

Commit

Permalink
Fixed CMake build
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Oct 9, 2019
1 parent cf0060d commit 4c87cef
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set(FLEECE_BASE_SRC Fleece/Support/Backtrace.cc
Fleece/Support/RefCounted.cc
Fleece/Support/Writer.cc
Fleece/Support/betterassert.cc
Fleece/Support/FLSlice.cc
Fleece/API_Impl/FLSlice.cc
Fleece/Support/slice.cc
Fleece/Support/varint.cc
vendor/libb64/cdecode.c
Expand Down
17 changes: 10 additions & 7 deletions Fleece/API_Impl/FLSlice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
// limitations under the License.
//

#include "FLSlice.h"
#include "fleece/FLSlice.h"
#include <atomic>
#include <cstddef>
#include "betterassert.hh"


bool FLSlice_Equal(FLSlice a, FLSlice b) {
Expand Down Expand Up @@ -83,10 +86,6 @@ namespace fleece {
free(self);
}

static sharedBuffer* fromBuf(const void *buf) {
return offsetby((sharedBuffer*)buf, -((long long)offsetof(sharedBuffer, _buf)));
}

inline void retain() noexcept {
assert(isHeapAligned(this));
++_refCount;
Expand All @@ -99,6 +98,10 @@ namespace fleece {
}
};

static sharedBuffer* bufferFromBuf(const void *buf) {
return (sharedBuffer*)((uint8_t*)buf - offsetof(sharedBuffer, _buf));
}

}

using namespace fleece;
Expand Down Expand Up @@ -137,13 +140,13 @@ void _FLBuf_Release(const void*);

void _FLBuf_Retain(const void *buf) {
if (buf)
sharedBuffer::fromBuf(buf)->retain();
bufferFromBuf(buf)->retain();
}


void _FLBuf_Release(const void *buf) {
if (buf)
sharedBuffer::fromBuf(buf)->release();
bufferFromBuf(buf)->release();
}


4 changes: 2 additions & 2 deletions Fleece/Support/Fleece.exp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ _kFLEmptyDict

_FLSlice_Equal
_FLSlice_Compare
_FLSliceResult_Retain
_FLSliceResult_Release
__FLBuf_Retain
__FLBuf_Release

_FLDoc_FromResultData
_FLDoc_FromJSON
Expand Down
8 changes: 4 additions & 4 deletions Fleece/Support/betterassert.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
#endif // assert_always


#ifndef NDEBUG

#undef assert
#undef assert
#ifdef NDEBUG
#define assert(e) ((void)0)
#else
#define assert(e) assert_always(e)

#endif //NDEBUG
3 changes: 2 additions & 1 deletion cmake/platform_base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function(set_source_files_base)
set(
${BASE_SSS_RESULT}
Fleece/API_Impl/Fleece.cc
Fleece/API_Impl/FLSlice.cc
Fleece/Core/Array.cc
Fleece/Core/DeepIterator.cc
Fleece/Core/Dict.cc
Expand Down Expand Up @@ -77,4 +78,4 @@ function(set_test_source_files_base)
Experimental/KeyTree.cc
PARENT_SCOPE
)
endfunction()
endfunction()

0 comments on commit 4c87cef

Please sign in to comment.