Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed Nov 27, 2024
1 parent 6181d1e commit d9adeef
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 79 deletions.
18 changes: 9 additions & 9 deletions libudpard/udpard.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,13 @@ static inline byte_t* txSerializeHeader(byte_t* const destination_buffe
/// Produces a chain of Tx queue items for later insertion into the Tx queue. The tail is NULL if OOM.
/// The caller is responsible for freeing the memory allocated for the chain.
static inline TxChain txMakeChain(const struct UdpardTxMemoryResources memory,
const uint_least8_t dscp_value_per_priority[UDPARD_PRIORITY_MAX + 1U],
const size_t mtu,
const UdpardMicrosecond deadline_usec,
const TransferMetadata meta,
const struct UdpardUDPIPEndpoint endpoint,
const struct UdpardPayload payload,
void* const user_transfer_reference)
const uint_least8_t dscp_value_per_priority[UDPARD_PRIORITY_MAX + 1U],
const size_t mtu,
const UdpardMicrosecond deadline_usec,
const TransferMetadata meta,
const struct UdpardUDPIPEndpoint endpoint,
const struct UdpardPayload payload,
void* const user_transfer_reference)
{
UDPARD_ASSERT(mtu > 0);
UDPARD_ASSERT((payload.data != NULL) || (payload.size == 0U));
Expand Down Expand Up @@ -443,9 +443,9 @@ static inline TxChain txMakeChain(const struct UdpardTxMemoryResources memory,
{
break;
}
const bool last = (payload_size_with_crc - offset) <= mtu;
const bool last = (payload_size_with_crc - offset) <= mtu;
byte_t* const dst_buffer = item->base.datagram_payload.data;
byte_t* write_ptr = txSerializeHeader(dst_buffer, meta, (uint32_t) out.count, last);
byte_t* write_ptr = txSerializeHeader(dst_buffer, meta, (uint32_t) out.count, last);
if (offset < payload.size)
{
const size_t progress = smaller(payload.size - offset, mtu);
Expand Down
140 changes: 70 additions & 70 deletions tests/src/test_intrusive_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ static void testMakeChainEmpty(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityFast,
.src_node_id = 1234,
.dst_node_id = 2345,
.data_specifier = 5432,
.transfer_id = 0xBADC0FFEE0DDF00DULL,
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityFast,
.src_node_id = 1234,
.dst_node_id = 2345,
.data_specifier = 5432,
.transfer_id = 0xBADC0FFEE0DDF00DULL,
};
const TxChain chain = txMakeChain(mem,
(byte_t[]){11, 22, 33, 44, 55, 66, 77, 88},
Expand Down Expand Up @@ -143,15 +143,15 @@ static void testMakeChainSingleMaxMTU(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPrioritySlow,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPrioritySlow,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
};
const TxChain chain = txMakeChain(mem,
(byte_t[]){11, 22, 33, 44, 55, 66, 77, 88},
Expand Down Expand Up @@ -197,9 +197,9 @@ static void testMakeChainSingleFrameDefaultMTU(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
const byte_t payload[UDPARD_MTU_DEFAULT_MAX_SINGLE_FRAME + 1] = {0};
const byte_t payload[UDPARD_MTU_DEFAULT_MAX_SINGLE_FRAME + 1] = {0};
{ // Ensure UDPARD_MTU_DEFAULT_MAX_SINGLE_FRAME bytes fit in a single frame with the default MTU.
const TxChain chain = txMakeChain(mem,
(byte_t[]){11, 22, 33, 44, 55, 66, 77, 88},
Expand Down Expand Up @@ -257,15 +257,15 @@ static void testMakeChainThreeFrames(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
};
const size_t mtu = (EtherealStrengthSize + 4U + 3U) / 3U; // Force payload split into three frames.
const TxChain chain = txMakeChain(mem,
Expand Down Expand Up @@ -342,15 +342,15 @@ static void testMakeChainCRCSpill1(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
};
const size_t mtu = InterstellarWarSize + 3U;
const TxChain chain = txMakeChain(mem,
Expand Down Expand Up @@ -417,15 +417,15 @@ static void testMakeChainCRCSpill2(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
};
const size_t mtu = InterstellarWarSize + 2U;
const TxChain chain = txMakeChain(mem,
Expand Down Expand Up @@ -492,15 +492,15 @@ static void testMakeChainCRCSpill3(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
};
const size_t mtu = InterstellarWarSize + 1U;
const TxChain chain = txMakeChain(mem,
Expand Down Expand Up @@ -567,15 +567,15 @@ static void testMakeChainCRCSpillFull(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
char user_transfer_referent = '\0';
const TransferMetadata meta = {
.priority = UdpardPriorityNominal,
.src_node_id = 4321,
.dst_node_id = 5432,
.data_specifier = 7766,
.transfer_id = 0x0123456789ABCDEFULL,
};
const size_t mtu = InterstellarWarSize;
const TxChain chain = txMakeChain(mem,
Expand Down Expand Up @@ -638,9 +638,9 @@ static void testPushPeekPopFree(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
const UdpardNodeID node_id = 1234;
const UdpardNodeID node_id = 1234;
//
UdpardTx tx = {
.local_node_id = &node_id,
Expand Down Expand Up @@ -720,9 +720,9 @@ static void testPushPrioritization(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
const UdpardNodeID node_id = 1234;
const UdpardNodeID node_id = 1234;
//
UdpardTx tx = {
.local_node_id = &node_id,
Expand Down Expand Up @@ -894,9 +894,9 @@ static void testPushCapacityLimit(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
const UdpardNodeID node_id = 1234;
const UdpardNodeID node_id = 1234;
//
UdpardTx tx = {
.local_node_id = &node_id,
Expand Down Expand Up @@ -932,9 +932,9 @@ static void testPushOOM(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
const UdpardNodeID node_id = 1234;
const UdpardNodeID node_id = 1234;
//
UdpardTx tx = {
.local_node_id = &node_id,
Expand Down Expand Up @@ -971,9 +971,9 @@ static void testPushAnonymousMultiFrame(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
const UdpardNodeID node_id = 0xFFFFU;
const UdpardNodeID node_id = 0xFFFFU;
//
UdpardTx tx = {
.local_node_id = &node_id,
Expand Down Expand Up @@ -1009,9 +1009,9 @@ static void testPushAnonymousService(void)
instrumentedAllocatorNew(&alloc);
const struct UdpardTxMemoryResources mem = {
.fragment = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
.payload = instrumentedAllocatorMakeMemoryResource(&alloc),
};
const UdpardNodeID node_id = 0xFFFFU;
const UdpardNodeID node_id = 0xFFFFU;
//
UdpardTx tx = {
.local_node_id = &node_id,
Expand Down

0 comments on commit d9adeef

Please sign in to comment.