Skip to content

Commit f42ad57

Browse files
nits
1 parent e2f7301 commit f42ad57

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

tests/src/helpers.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
/// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44

55
// ReSharper disable CppRedundantInlineSpecifier
6-
// NOLINTBEGIN(*DeprecatedOrUnsafeBufferHandling,*err34-c)
6+
// NOLINTBEGIN(*-unchecked-string-to-number-conversion,*-deprecated-headers,*-designated-initializers,*-loop-convert)
7+
// NOLINTBEGIN(*DeprecatedOrUnsafeBufferHandling,*err34-c,*-vararg,*-use-auto,*-use-nullptr,*-redundant-void-arg)
8+
// NOLINTBEGIN(*-cstyle-cast)
79
#pragma once
810

911
#include <udpard.h> // Shall always be included first.
@@ -74,7 +76,7 @@ typedef struct
7476
static inline void* instrumented_allocator_alloc(void* const user_reference, const size_t size)
7577
{
7678
instrumented_allocator_t* const self = (instrumented_allocator_t*)user_reference;
77-
void* result = NULL;
79+
void* result = NULL; // NOLINT(*-const-correctness)
7880
self->count_alloc++;
7981
if ((size > 0U) && //
8082
((self->allocated_bytes + size) <= self->limit_bytes) && //
@@ -83,7 +85,7 @@ static inline void* instrumented_allocator_alloc(void* const user_reference, con
8385
void* origin = malloc(size_with_canaries);
8486
TEST_PANIC_UNLESS(origin != NULL);
8587
*((size_t*)origin) = size;
86-
uint_least8_t* p = ((uint_least8_t*)origin) + sizeof(size_t);
88+
uint_least8_t* p = ((uint_least8_t*)origin) + sizeof(size_t); // NOLINT(*-const-correctness)
8789
result = ((uint_least8_t*)origin) + INSTRUMENTED_ALLOCATOR_CANARY_SIZE;
8890
for (size_t i = sizeof(size_t); i < INSTRUMENTED_ALLOCATOR_CANARY_SIZE; i++) // Fill the front canary.
8991
{
@@ -107,7 +109,7 @@ static inline void instrumented_allocator_free(void* const user_reference, const
107109
{
108110
instrumented_allocator_t* const self = (instrumented_allocator_t*)user_reference;
109111
self->count_free++;
110-
if (pointer != NULL) {
112+
if (pointer != NULL) { // NOLINTNEXTLINE(*-const-correctness)
111113
uint_least8_t* p = ((uint_least8_t*)pointer) - INSTRUMENTED_ALLOCATOR_CANARY_SIZE;
112114
void* const origin = p;
113115
const size_t true_size = *((const size_t*)origin);
@@ -183,4 +185,6 @@ static inline void seed_prng(void)
183185
}
184186
#endif
185187

186-
// NOLINTEND(*DeprecatedOrUnsafeBufferHandling,*err34-c)
188+
// NOLINTEND(*-cstyle-cast)
189+
// NOLINTEND(*DeprecatedOrUnsafeBufferHandling,*err34-c,*-vararg,*-use-auto,*-use-nullptr,*-redundant-void-arg)
190+
// NOLINTEND(*-unchecked-string-to-number-conversion,*-deprecated-headers,*-designated-initializers,*-loop-convert)

tests/src/test_public.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
namespace {
1212

1313
/// The data is copied.
14-
udpard_fragment_t* make_test_fragment(const udpard_mem_resource_t fragment_memory,
15-
const udpard_mem_resource_t payload_memory,
16-
const udpard_mem_deleter_t payload_deleter,
17-
const size_t offset,
18-
const size_t size,
19-
const void* data)
14+
udpard_fragment_t* make_test_fragment(const udpard_mem_resource_t& fragment_memory,
15+
const udpard_mem_resource_t& payload_memory,
16+
const udpard_mem_deleter_t payload_deleter,
17+
const size_t offset,
18+
const size_t size,
19+
const void* data)
2020
{
2121
auto* frag =
2222
static_cast<udpard_fragment_t*>(fragment_memory.alloc(fragment_memory.user, sizeof(udpard_fragment_t)));

0 commit comments

Comments
 (0)