Commit 8cdba6aa authored by tqcq's avatar tqcq
Browse files

feat update

parent 56174300
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -185,14 +185,15 @@ endif(SLED_BUILD_TESTS)

if(SLED_BUILD_FUZZ)

  macro(add_fuzz_test name sources)
  function(add_fuzz_test name sources)
    add_executable(${name} ${sources})
    target_link_libraries(${name} PRIVATE sled)
    target_compile_options(${name} PRIVATE -g -O1 -fsanitize=fuzzer,address
                                           -fsanitize-coverage=trace-cmp)
    target_link_options(${name} PRIVATE -fsanitize=fuzzer,address
                        -fsanitize-coverage=trace-cmp)
  endmacro()
  endfunction()

  add_fuzz_test(base64_fuzz src/sled/strings/base64_fuzz.cc)
  add_fuzz_test(uri_fuzz src/sled/uri_fuzz.cc)
endif(SLED_BUILD_FUZZ)
+7 −0
Original line number Diff line number Diff line
@@ -9,6 +9,13 @@
#define PATH_MAX_SZ PATH_MAX
#endif

#if defined(_WIN32)
#include <direct.h>
#define getcwd _getcwd
#else
#include <unistd.h>
#endif

namespace sled {
Path
Path::Current()
+2 −0
Original line number Diff line number Diff line
@@ -116,6 +116,8 @@ void Log(LogLevel level, const char *tag, const char *fmt, const char *file_name
#define LOGF(tag, fmt, ...) SLOG(sled::LogLevel::kFatal, tag, fmt, ##__VA_ARGS__)

#define ASSERT(cond, fmt, ...) SLOG_ASSERT(cond, "ASSERT", fmt, ##__VA_ARGS__)
#define SLED_ASSERT(cond, fmt, ...) SLOG_ASSERT(cond, "ASSERT", fmt, ##__VA_ARGS__)
#define SLED_DASSERT(cond, fmt, ...) SLOG_ASSERT(cond, "ASSERT", fmt, ##__VA_ARGS__)

#define __LOG_EVERY_N(n, level, tag, fmt, ...)                                                                         \
    do {                                                                                                               \
+3 −9
Original line number Diff line number Diff line
@@ -22,19 +22,13 @@ public:

    sled::RefCountReleaseStatus DecRef()
    {
        int ref_count_after_subtract =
            ref_count_.fetch_sub(1, std::memory_order_acq_rel) - 1;
        int ref_count_after_subtract = ref_count_.fetch_sub(1, std::memory_order_acq_rel) - 1;

        if (ref_count_after_subtract == 0) {
            return sled::RefCountReleaseStatus::kDroppedLastRef;
        }
        if (ref_count_after_subtract == 0) { return sled::RefCountReleaseStatus::kDroppedLastRef; }
        return sled::RefCountReleaseStatus::kOtherRefsRemained;
    }

    bool HasOneRef() const
    {
        return ref_count_.load(std::memory_order_acquire) == 1;
    }
    bool HasOneRef() const { return ref_count_.load(std::memory_order_acquire) == 1; }

private:
    std::atomic<int> ref_count_;
+0 −1
Original line number Diff line number Diff line
#include <gtest/gtest.h>
Loading