reformat source code
according to code styles, 'AccessModifierOffset' should be -2.
This commit is contained in:
		@ -34,7 +34,7 @@ void has_unfree_callback()
 | 
			
		||||
  has_unfree = true;
 | 
			
		||||
}
 | 
			
		||||
class TestAllocator : public ::testing::Test {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  virtual void SetUp()
 | 
			
		||||
  {
 | 
			
		||||
    ObMallocAllocator* ma = ObMallocAllocator::get_instance();
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@
 | 
			
		||||
using namespace oceanbase::common;
 | 
			
		||||
 | 
			
		||||
class BuddyAllocatorTest : public ::testing::Test {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  BuddyAllocatorTest();
 | 
			
		||||
  virtual ~BuddyAllocatorTest();
 | 
			
		||||
  virtual void SetUp();
 | 
			
		||||
@ -32,12 +32,12 @@ class BuddyAllocatorTest : public ::testing::Test {
 | 
			
		||||
  void assign_ptr(char* ptr, int64_t ptr_len, int64_t seed);
 | 
			
		||||
  bool is_valid_ptr(const char* ptr, int64_t ptr_len, int64_t seed);
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  // disallow copy
 | 
			
		||||
  BuddyAllocatorTest(const BuddyAllocatorTest& other);
 | 
			
		||||
  BuddyAllocatorTest& operator=(const BuddyAllocatorTest& other);
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  // data members
 | 
			
		||||
};
 | 
			
		||||
BuddyAllocatorTest::BuddyAllocatorTest()
 | 
			
		||||
@ -179,7 +179,7 @@ TEST_F(BuddyAllocatorTest, basic_test)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ObPtrStore {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  int64_t seed_;
 | 
			
		||||
  int64_t ptr_len_;
 | 
			
		||||
  char* ptr_;
 | 
			
		||||
 | 
			
		||||
@ -23,13 +23,13 @@ static const int64_t TOTAL_SIZE = 1024l * 1024l * 1024l * 8l;
 | 
			
		||||
static const int64_t PAGE_SIZE = 64 * 1024;
 | 
			
		||||
 | 
			
		||||
class TestC {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  TestC()
 | 
			
		||||
  {}
 | 
			
		||||
  virtual ~TestC()
 | 
			
		||||
  {}
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  // a successful virtual function invoking represents a good vtable
 | 
			
		||||
  virtual void set_mem_a(int64_t value)
 | 
			
		||||
  {
 | 
			
		||||
@ -48,7 +48,7 @@ class TestC {
 | 
			
		||||
    return mem_b_;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  int64_t mem_a_;
 | 
			
		||||
  int64_t mem_b_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										22
									
								
								deps/oblib/unittest/lib/allocator/test_fifo.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								deps/oblib/unittest/lib/allocator/test_fifo.cpp
									
									
									
									
										vendored
									
									
								
							@ -37,7 +37,7 @@ int64_t glibc_free_count = 0;
 | 
			
		||||
#define MOCK_ALLOC_ALIGN 1
 | 
			
		||||
 | 
			
		||||
class MockAllocator : public ObIAllocator {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  MockAllocator() : alloc_count_(0), free_count_(0), page_size_(page_size), last_alloc_addr_(NULL), status_(true)
 | 
			
		||||
  {}
 | 
			
		||||
 | 
			
		||||
@ -151,7 +151,7 @@ class MockAllocator : public ObIAllocator {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class ObFIFOAllocatorTest : public ::testing::Test {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  ObFIFOAllocatorTest();
 | 
			
		||||
  virtual ~ObFIFOAllocatorTest();
 | 
			
		||||
  virtual void SetUp();
 | 
			
		||||
@ -237,7 +237,7 @@ TEST(ObFIFOAllocator, invalid_free)
 | 
			
		||||
 | 
			
		||||
// [4] test alignment
 | 
			
		||||
class ObFIFOAllocatorAlignParamTest : public ::testing::TestWithParam<AllocParam> {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  ObFIFOAllocatorAlignParamTest()
 | 
			
		||||
  {
 | 
			
		||||
    mock_allocator_ = new MockAllocator();
 | 
			
		||||
@ -251,10 +251,10 @@ class ObFIFOAllocatorAlignParamTest : public ::testing::TestWithParam<AllocParam
 | 
			
		||||
  }
 | 
			
		||||
  bool check_align(void* p, int64_t align);
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  ObFIFOAllocator* fa_;
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  MockAllocator* mock_allocator_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -324,7 +324,7 @@ struct AllocParam ps11 = {page_size, 1024 * 8};
 | 
			
		||||
struct AllocParam alloc_param_special[11] = {ps1, ps2, ps3, ps4, ps5, ps6, ps7, ps8, ps9, ps10, ps11};
 | 
			
		||||
 | 
			
		||||
class ObFIFOAllocatorSpecialPageListTest {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  ObFIFOAllocatorSpecialPageListTest()
 | 
			
		||||
  {
 | 
			
		||||
    mock_allocator_ = new MockAllocator();
 | 
			
		||||
@ -337,11 +337,11 @@ class ObFIFOAllocatorSpecialPageListTest {
 | 
			
		||||
    delete mock_allocator_;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  void check_special_list();
 | 
			
		||||
  ObFIFOAllocator* fa_;
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  MockAllocator* mock_allocator_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -415,7 +415,7 @@ TEST(ObFIFOAllocatorSpecialPageListTest, non_fifo_special_list_test)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ObFIFOAllocatorNormalPageListTest {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  ObFIFOAllocatorNormalPageListTest()
 | 
			
		||||
  {
 | 
			
		||||
    mock_allocator_ = new MockAllocator();
 | 
			
		||||
@ -494,10 +494,10 @@ class ObFIFOAllocatorNormalPageListTest {
 | 
			
		||||
    return rand() % MAX_SIZE + 1;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  ObFIFOAllocator* fa_;
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  MockAllocator* mock_allocator_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -24,13 +24,13 @@ using namespace oceanbase::common;
 | 
			
		||||
static const int64_t PAGE_SIZE = 64 * 1024;
 | 
			
		||||
 | 
			
		||||
class TestC {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  TestC()
 | 
			
		||||
  {}
 | 
			
		||||
  virtual ~TestC()
 | 
			
		||||
  {}
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  // a successful virtual function invoking represents a good vtable
 | 
			
		||||
  virtual void set_mem_a(int64_t value)
 | 
			
		||||
  {
 | 
			
		||||
@ -49,7 +49,7 @@ class TestC {
 | 
			
		||||
    return mem_b_;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  int64_t mem_a_;
 | 
			
		||||
  int64_t mem_b_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ using namespace oceanbase::common;
 | 
			
		||||
 | 
			
		||||
#define ISIZE 64
 | 
			
		||||
struct AllocInterface {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  virtual void* alloc() = 0;
 | 
			
		||||
  virtual void free(void* p) = 0;
 | 
			
		||||
  virtual int64_t hold()
 | 
			
		||||
@ -38,7 +38,7 @@ struct AllocInterface {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct MallocWrapper : public AllocInterface {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  void* alloc()
 | 
			
		||||
  {
 | 
			
		||||
    return ::malloc(ISIZE);
 | 
			
		||||
@ -50,7 +50,7 @@ struct MallocWrapper : public AllocInterface {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct ObMallocWrapper : public AllocInterface {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  void* alloc()
 | 
			
		||||
  {
 | 
			
		||||
    return common::ob_malloc(ISIZE);
 | 
			
		||||
@ -62,7 +62,7 @@ struct ObMallocWrapper : public AllocInterface {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct SmallAllocWrapper : public AllocInterface, public ObSmallAllocator {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  SmallAllocWrapper()
 | 
			
		||||
  {
 | 
			
		||||
    alloc_.init(ISIZE);
 | 
			
		||||
@ -76,12 +76,12 @@ struct SmallAllocWrapper : public AllocInterface, public ObSmallAllocator {
 | 
			
		||||
    alloc_.free(p);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  ObSmallAllocator alloc_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct OpAllocWrapper : public AllocInterface {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  struct Item {
 | 
			
		||||
    char data[ISIZE];
 | 
			
		||||
  };
 | 
			
		||||
@ -96,7 +96,7 @@ struct OpAllocWrapper : public AllocInterface {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct OpReclaimAllocWrapper : public AllocInterface {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  struct Item {
 | 
			
		||||
    char data[ISIZE];
 | 
			
		||||
  };
 | 
			
		||||
@ -112,7 +112,7 @@ struct OpReclaimAllocWrapper : public AllocInterface {
 | 
			
		||||
 | 
			
		||||
ObMemAttr mem_attr;
 | 
			
		||||
struct SliceAllocWrapper : public AllocInterface {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  SliceAllocWrapper() : alloc_(ISIZE, mem_attr, OB_MALLOC_BIG_BLOCK_SIZE)
 | 
			
		||||
  {
 | 
			
		||||
    alloc_.set_nway(64);
 | 
			
		||||
@ -134,12 +134,12 @@ struct SliceAllocWrapper : public AllocInterface {
 | 
			
		||||
    return alloc_.hold();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  ObSliceAlloc alloc_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct VSliceAllocWrapper : public AllocInterface {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  VSliceAllocWrapper() : alloc_(mem_attr, OB_MALLOC_BIG_BLOCK_SIZE)
 | 
			
		||||
  {
 | 
			
		||||
    alloc_.set_nway(64);
 | 
			
		||||
@ -161,12 +161,12 @@ struct VSliceAllocWrapper : public AllocInterface {
 | 
			
		||||
    return alloc_.hold();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  ObVSliceAlloc alloc_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct SimpleFifoAllocWrapper : public AllocInterface {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  SimpleFifoAllocWrapper() : alloc_(mem_attr, OB_MALLOC_BIG_BLOCK_SIZE)
 | 
			
		||||
  {
 | 
			
		||||
    alloc_.set_nway(64);
 | 
			
		||||
@ -188,13 +188,13 @@ struct SimpleFifoAllocWrapper : public AllocInterface {
 | 
			
		||||
    return alloc_.hold();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  ObSimpleFifoAlloc alloc_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
ObTCCounter gcounter;
 | 
			
		||||
class FixedStack {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  FixedStack() : top_(base_)
 | 
			
		||||
  {}
 | 
			
		||||
  void push(void* p)
 | 
			
		||||
@ -208,7 +208,7 @@ class FixedStack {
 | 
			
		||||
    return *--top_;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  void** top_;
 | 
			
		||||
  void* base_[4096];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -19,19 +19,19 @@ using namespace oceanbase::common;
 | 
			
		||||
using namespace oceanbase::lib;
 | 
			
		||||
 | 
			
		||||
class TestSQLArenaAllocator : public ::testing::Test {
 | 
			
		||||
  public:
 | 
			
		||||
public:
 | 
			
		||||
  TestSQLArenaAllocator();
 | 
			
		||||
  virtual ~TestSQLArenaAllocator();
 | 
			
		||||
  virtual void SetUp();
 | 
			
		||||
  virtual void TearDown();
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
private:
 | 
			
		||||
  // disallow copy
 | 
			
		||||
  DISALLOW_COPY_AND_ASSIGN(TestSQLArenaAllocator);
 | 
			
		||||
 | 
			
		||||
  protected:
 | 
			
		||||
protected:
 | 
			
		||||
  // function members
 | 
			
		||||
  protected:
 | 
			
		||||
protected:
 | 
			
		||||
  // data members
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user