Ver a proveniência

leveldb: Rename SNAPPY to HAVE_SNAPPY.

This follows the general naming convention for preprocessor macros used
to detect feature (library / header file / symbol) presence.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171184641
ld
costan há 7 anos
committed by Victor Costan
ascendente
cometimento
ca216e493f
2 ficheiros alterados com 14 adições e 14 eliminações
  1. +6
    -6
      build_detect_platform
  2. +8
    -8
      port/port_posix.h

+ 6
- 6
build_detect_platform Ver ficheiro

@ -21,8 +21,8 @@
# The PLATFORM_CCFLAGS and PLATFORM_CXXFLAGS might include the following: # The PLATFORM_CCFLAGS and PLATFORM_CXXFLAGS might include the following:
# #
# -DLEVELDB_ATOMIC_PRESENT if <atomic> is present # -DLEVELDB_ATOMIC_PRESENT if <atomic> is present
# -DLEVELDB_PLATFORM_POSIX for Posix-based platforms
# -DSNAPPY if the Snappy library is present
# -DLEVELDB_PLATFORM_POSIX=1 for Posix-based platforms
# -DHAVE_SNAPPY=1 if the Snappy library is present
# #
OUTPUT=$1 OUTPUT=$1
@ -133,7 +133,7 @@ case "$TARGET_OS" in
;; ;;
OS_ANDROID_CROSSCOMPILE) OS_ANDROID_CROSSCOMPILE)
PLATFORM=OS_ANDROID PLATFORM=OS_ANDROID
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_ANDROID -DLEVELDB_PLATFORM_POSIX"
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_ANDROID -DLEVELDB_PLATFORM_POSIX=1"
PLATFORM_LDFLAGS="" # All pthread features are in the Android C library PLATFORM_LDFLAGS="" # All pthread features are in the Android C library
PORT_FILE=port/port_posix.cc PORT_FILE=port/port_posix.cc
PORT_SSE_FILE=port/port_posix_sse.cc PORT_SSE_FILE=port/port_posix_sse.cc
@ -196,10 +196,10 @@ else
int main() {} int main() {}
EOF EOF
if [ "$?" = 0 ]; then if [ "$?" = 0 ]; then
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX -DLEVELDB_ATOMIC_PRESENT"
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX=1 -DLEVELDB_ATOMIC_PRESENT"
PLATFORM_CXXFLAGS="-std=c++0x" PLATFORM_CXXFLAGS="-std=c++0x"
else else
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX"
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX=1"
fi fi
# Test whether Snappy library is installed # Test whether Snappy library is installed
@ -209,7 +209,7 @@ EOF
int main() {} int main() {}
EOF EOF
if [ "$?" = 0 ]; then if [ "$?" = 0 ]; then
COMMON_FLAGS="$COMMON_FLAGS -DSNAPPY"
COMMON_FLAGS="$COMMON_FLAGS -DHAVE_SNAPPY=1"
PLATFORM_LIBS="$PLATFORM_LIBS -lsnappy" PLATFORM_LIBS="$PLATFORM_LIBS -lsnappy"
fi fi

+ 8
- 8
port/port_posix.h Ver ficheiro

@ -39,9 +39,9 @@
#endif #endif
#include <pthread.h> #include <pthread.h>
#ifdef SNAPPY
#ifdef HAVE_SNAPPY
#include <snappy.h> #include <snappy.h>
#endif
#endif // defined(HAVE_SNAPPY)
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include "port/atomic_pointer.h" #include "port/atomic_pointer.h"
@ -106,33 +106,33 @@ extern void InitOnce(OnceType* once, void (*initializer)());
inline bool Snappy_Compress(const char* input, size_t length, inline bool Snappy_Compress(const char* input, size_t length,
::std::string* output) { ::std::string* output) {
#ifdef SNAPPY
#ifdef HAVE_SNAPPY
output->resize(snappy::MaxCompressedLength(length)); output->resize(snappy::MaxCompressedLength(length));
size_t outlen; size_t outlen;
snappy::RawCompress(input, length, &(*output)[0], &outlen); snappy::RawCompress(input, length, &(*output)[0], &outlen);
output->resize(outlen); output->resize(outlen);
return true; return true;
#endif
#endif // defined(HAVE_SNAPPY)
return false; return false;
} }
inline bool Snappy_GetUncompressedLength(const char* input, size_t length, inline bool Snappy_GetUncompressedLength(const char* input, size_t length,
size_t* result) { size_t* result) {
#ifdef SNAPPY
#ifdef HAVE_SNAPPY
return snappy::GetUncompressedLength(input, length, result); return snappy::GetUncompressedLength(input, length, result);
#else #else
return false; return false;
#endif
#endif // defined(HAVE_SNAPPY)
} }
inline bool Snappy_Uncompress(const char* input, size_t length, inline bool Snappy_Uncompress(const char* input, size_t length,
char* output) { char* output) {
#ifdef SNAPPY
#ifdef HAVE_SNAPPY
return snappy::RawUncompress(input, length, output); return snappy::RawUncompress(input, length, output);
#else #else
return false; return false;
#endif
#endif // defined(HAVE_SNAPPY)
} }
inline bool GetHeapProfile(void (*func)(void*, const char*, int), void* arg) { inline bool GetHeapProfile(void (*func)(void*, const char*, int), void* arg) {

Carregando…
Cancelar
Guardar