Correct a few typos
This commit is contained in:
		
							parent
							
								
									52da897e22
								
							
						
					
					
						commit
						88c503e7e5
					
				
					 8 changed files with 34 additions and 34 deletions
				
			
		| 
						 | 
				
			
			@ -50,7 +50,7 @@ rcl_subscription_init(
 | 
			
		|||
  RCL_CHECK_ARGUMENT_FOR_NULL(topic_name, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(options, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (subscription->impl) {
 | 
			
		||||
    RCL_SET_ERROR_MSG("subscription already initialized, or memory was uninialized");
 | 
			
		||||
    RCL_SET_ERROR_MSG("subscription already initialized, or memory was uninitialized");
 | 
			
		||||
    return RCL_RET_ALREADY_INIT;
 | 
			
		||||
  }
 | 
			
		||||
  const rcl_allocator_t * allocator = &options->allocator;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -122,19 +122,19 @@ void assert_no_malloc_begin() {}
 | 
			
		|||
 | 
			
		||||
void assert_no_malloc_end() {}
 | 
			
		||||
 | 
			
		||||
void set_on_unepexcted_malloc_callback(UnexpectedCallbackType callback) {}
 | 
			
		||||
void set_on_unexpected_malloc_callback(UnexpectedCallbackType callback) {}
 | 
			
		||||
 | 
			
		||||
void assert_no_realloc_begin() {}
 | 
			
		||||
 | 
			
		||||
void assert_no_realloc_end() {}
 | 
			
		||||
 | 
			
		||||
void set_on_unepexcted_realloc_callback(UnexpectedCallbackType callback) {}
 | 
			
		||||
void set_on_unexpected_realloc_callback(UnexpectedCallbackType callback) {}
 | 
			
		||||
 | 
			
		||||
void assert_no_free_begin() {}
 | 
			
		||||
 | 
			
		||||
void assert_no_free_end() {}
 | 
			
		||||
 | 
			
		||||
void set_on_unepexcted_free_callback(UnexpectedCallbackType callback) {}
 | 
			
		||||
void set_on_unexpected_free_callback(UnexpectedCallbackType callback) {}
 | 
			
		||||
 | 
			
		||||
void memory_checking_thread_init() {}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ void
 | 
			
		|||
assert_no_malloc_end();
 | 
			
		||||
RCL_MEMORY_TOOLS_PUBLIC
 | 
			
		||||
void
 | 
			
		||||
set_on_unepexcted_malloc_callback(UnexpectedCallbackType callback);
 | 
			
		||||
set_on_unexpected_malloc_callback(UnexpectedCallbackType callback);
 | 
			
		||||
 | 
			
		||||
#define ASSERT_NO_REALLOC(statements) \
 | 
			
		||||
  assert_no_realloc_begin(); statements; assert_no_realloc_end();
 | 
			
		||||
| 
						 | 
				
			
			@ -82,7 +82,7 @@ void
 | 
			
		|||
assert_no_realloc_end();
 | 
			
		||||
RCL_MEMORY_TOOLS_PUBLIC
 | 
			
		||||
void
 | 
			
		||||
set_on_unepexcted_realloc_callback(UnexpectedCallbackType callback);
 | 
			
		||||
set_on_unexpected_realloc_callback(UnexpectedCallbackType callback);
 | 
			
		||||
 | 
			
		||||
#define ASSERT_NO_FREE(statements) \
 | 
			
		||||
  assert_no_free_begin(); statements; assert_no_free_end();
 | 
			
		||||
| 
						 | 
				
			
			@ -94,7 +94,7 @@ void
 | 
			
		|||
assert_no_free_end();
 | 
			
		||||
RCL_MEMORY_TOOLS_PUBLIC
 | 
			
		||||
void
 | 
			
		||||
set_on_unepexcted_free_callback(UnexpectedCallbackType callback);
 | 
			
		||||
set_on_unexpected_free_callback(UnexpectedCallbackType callback);
 | 
			
		||||
 | 
			
		||||
RCL_MEMORY_TOOLS_PUBLIC
 | 
			
		||||
void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ static std::atomic<bool> enabled(false);
 | 
			
		|||
 | 
			
		||||
static __thread bool malloc_expected = true;
 | 
			
		||||
static __thread UnexpectedCallbackType * unexpected_malloc_callback = nullptr;
 | 
			
		||||
void set_on_unepexcted_malloc_callback(UnexpectedCallbackType callback)
 | 
			
		||||
void set_on_unexpected_malloc_callback(UnexpectedCallbackType callback)
 | 
			
		||||
{
 | 
			
		||||
  if (unexpected_malloc_callback) {
 | 
			
		||||
    unexpected_malloc_callback->~UnexpectedCallbackType();
 | 
			
		||||
| 
						 | 
				
			
			@ -73,7 +73,7 @@ custom_malloc(size_t size)
 | 
			
		|||
 | 
			
		||||
static __thread bool realloc_expected = true;
 | 
			
		||||
static __thread UnexpectedCallbackType * unexpected_realloc_callback = nullptr;
 | 
			
		||||
void set_on_unepexcted_realloc_callback(UnexpectedCallbackType callback)
 | 
			
		||||
void set_on_unexpected_realloc_callback(UnexpectedCallbackType callback)
 | 
			
		||||
{
 | 
			
		||||
  if (unexpected_realloc_callback) {
 | 
			
		||||
    unexpected_realloc_callback->~UnexpectedCallbackType();
 | 
			
		||||
| 
						 | 
				
			
			@ -115,7 +115,7 @@ custom_realloc(void * memory_in, size_t size)
 | 
			
		|||
 | 
			
		||||
static __thread bool free_expected = true;
 | 
			
		||||
static __thread UnexpectedCallbackType * unexpected_free_callback = nullptr;
 | 
			
		||||
void set_on_unepexcted_free_callback(UnexpectedCallbackType callback)
 | 
			
		||||
void set_on_unexpected_free_callback(UnexpectedCallbackType callback)
 | 
			
		||||
{
 | 
			
		||||
  if (unexpected_free_callback) {
 | 
			
		||||
    unexpected_free_callback->~UnexpectedCallbackType();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,9 +28,9 @@ public:
 | 
			
		|||
  }
 | 
			
		||||
  void SetUp()
 | 
			
		||||
  {
 | 
			
		||||
    set_on_unepexcted_malloc_callback([]() {EXPECT_FALSE(true) << "UNEXPECTED MALLOC";});
 | 
			
		||||
    set_on_unepexcted_realloc_callback([]() {EXPECT_FALSE(true) << "UNEXPECTED REALLOC";});
 | 
			
		||||
    set_on_unepexcted_free_callback([]() {EXPECT_FALSE(true) << "UNEXPECTED FREE";});
 | 
			
		||||
    set_on_unexpected_malloc_callback([]() {EXPECT_FALSE(true) << "UNEXPECTED MALLOC";});
 | 
			
		||||
    set_on_unexpected_realloc_callback([]() {EXPECT_FALSE(true) << "UNEXPECTED REALLOC";});
 | 
			
		||||
    set_on_unexpected_free_callback([]() {EXPECT_FALSE(true) << "UNEXPECTED FREE";});
 | 
			
		||||
    start_memory_checking();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -40,9 +40,9 @@ public:
 | 
			
		|||
    assert_no_realloc_end();
 | 
			
		||||
    assert_no_free_end();
 | 
			
		||||
    stop_memory_checking();
 | 
			
		||||
    set_on_unepexcted_malloc_callback(nullptr);
 | 
			
		||||
    set_on_unepexcted_realloc_callback(nullptr);
 | 
			
		||||
    set_on_unepexcted_free_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_malloc_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_realloc_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_free_callback(nullptr);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -59,13 +59,13 @@ TEST_F(TestAllocatorFixture, test_default_allocator_normal) {
 | 
			
		|||
  size_t mallocs = 0;
 | 
			
		||||
  size_t reallocs = 0;
 | 
			
		||||
  size_t frees = 0;
 | 
			
		||||
  set_on_unepexcted_malloc_callback([&mallocs]() {
 | 
			
		||||
  set_on_unexpected_malloc_callback([&mallocs]() {
 | 
			
		||||
    mallocs++;
 | 
			
		||||
  });
 | 
			
		||||
  set_on_unepexcted_realloc_callback([&reallocs]() {
 | 
			
		||||
  set_on_unexpected_realloc_callback([&reallocs]() {
 | 
			
		||||
    reallocs++;
 | 
			
		||||
  });
 | 
			
		||||
  set_on_unepexcted_free_callback([&frees]() {
 | 
			
		||||
  set_on_unexpected_free_callback([&frees]() {
 | 
			
		||||
    frees++;
 | 
			
		||||
  });
 | 
			
		||||
  assert_no_malloc_begin();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,9 +24,9 @@ class TestRCLFixture : public::testing::Test
 | 
			
		|||
public:
 | 
			
		||||
  void SetUp()
 | 
			
		||||
  {
 | 
			
		||||
    set_on_unepexcted_malloc_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED MALLOC";});
 | 
			
		||||
    set_on_unepexcted_realloc_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED REALLOC";});
 | 
			
		||||
    set_on_unepexcted_free_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED FREE";});
 | 
			
		||||
    set_on_unexpected_malloc_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED MALLOC";});
 | 
			
		||||
    set_on_unexpected_realloc_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED REALLOC";});
 | 
			
		||||
    set_on_unexpected_free_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED FREE";});
 | 
			
		||||
    start_memory_checking();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -36,9 +36,9 @@ public:
 | 
			
		|||
    assert_no_realloc_end();
 | 
			
		||||
    assert_no_free_end();
 | 
			
		||||
    stop_memory_checking();
 | 
			
		||||
    set_on_unepexcted_malloc_callback(nullptr);
 | 
			
		||||
    set_on_unepexcted_realloc_callback(nullptr);
 | 
			
		||||
    set_on_unepexcted_free_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_malloc_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_realloc_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_free_callback(nullptr);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,9 +26,9 @@ class TestTimeFixture : public::testing::Test
 | 
			
		|||
public:
 | 
			
		||||
  void SetUp()
 | 
			
		||||
  {
 | 
			
		||||
    set_on_unepexcted_malloc_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED MALLOC";});
 | 
			
		||||
    set_on_unepexcted_realloc_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED REALLOC";});
 | 
			
		||||
    set_on_unepexcted_free_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED FREE";});
 | 
			
		||||
    set_on_unexpected_malloc_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED MALLOC";});
 | 
			
		||||
    set_on_unexpected_realloc_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED REALLOC";});
 | 
			
		||||
    set_on_unexpected_free_callback([]() {ASSERT_FALSE(true) << "UNEXPECTED FREE";});
 | 
			
		||||
    start_memory_checking();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -38,9 +38,9 @@ public:
 | 
			
		|||
    assert_no_realloc_end();
 | 
			
		||||
    assert_no_free_end();
 | 
			
		||||
    stop_memory_checking();
 | 
			
		||||
    set_on_unepexcted_malloc_callback(nullptr);
 | 
			
		||||
    set_on_unepexcted_realloc_callback(nullptr);
 | 
			
		||||
    set_on_unepexcted_free_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_malloc_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_realloc_callback(nullptr);
 | 
			
		||||
    set_on_unexpected_free_callback(nullptr);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,17 +23,17 @@ TEST(TestMemoryTools, test_allocation_checking_tools) {
 | 
			
		|||
  auto on_unexpected_malloc = ([&unexpected_mallocs]() {
 | 
			
		||||
    unexpected_mallocs++;
 | 
			
		||||
  });
 | 
			
		||||
  set_on_unepexcted_malloc_callback(on_unexpected_malloc);
 | 
			
		||||
  set_on_unexpected_malloc_callback(on_unexpected_malloc);
 | 
			
		||||
  size_t unexpected_reallocs = 0;
 | 
			
		||||
  auto on_unexpected_realloc = ([&unexpected_reallocs]() {
 | 
			
		||||
    unexpected_reallocs++;
 | 
			
		||||
  });
 | 
			
		||||
  set_on_unepexcted_realloc_callback(on_unexpected_realloc);
 | 
			
		||||
  set_on_unexpected_realloc_callback(on_unexpected_realloc);
 | 
			
		||||
  size_t unexpected_frees = 0;
 | 
			
		||||
  auto on_unexpected_free = ([&unexpected_frees]() {
 | 
			
		||||
    unexpected_frees++;
 | 
			
		||||
  });
 | 
			
		||||
  set_on_unepexcted_free_callback(on_unexpected_free);
 | 
			
		||||
  set_on_unexpected_free_callback(on_unexpected_free);
 | 
			
		||||
  void * mem = nullptr;
 | 
			
		||||
  void * remem = nullptr;
 | 
			
		||||
  // First try before enabling, should have no effect.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue