aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMosder <xmosder12@gmail.com>2026-07-31 20:59:31 +0200
committerMosder <xmosder12@gmail.com>2026-07-31 20:59:31 +0200
commitad5eb982de97d982bc808ece89903d1113ab9917 (patch)
treeacbb6865248f14d4faa16759943cefcceb94667b
parent4624152ac63ca3b4cbba0998d54fb0da84daef8c (diff)
refactor: apparently when you add , after last item in struct initalization it doesn't get formatted like shit by clang. crazy shit
-rw-r--r--analyzer/analyzer.c4
-rw-r--r--analyzer/structures/array.c7
-rw-r--r--analyzer/utils/tcp.c14
3 files changed, 7 insertions, 18 deletions
diff --git a/analyzer/analyzer.c b/analyzer/analyzer.c
index b3468d6..194ac5c 100644
--- a/analyzer/analyzer.c
+++ b/analyzer/analyzer.c
@@ -25,14 +25,12 @@ void cleanup_str_pointer(void *str_pointer) {
// initalize new total rewards
TotalRewards new_total_rewards() {
HashMap *saturations = hashmap_new(sizeof(const char *), sizeof(int), hash_str, compare_strs, NULL, NULL);
- // clang-format off
TotalRewards rewards = {
.exp = 0,
.gold = 0,
.psycho = 0,
- .saturations = saturations
+ .saturations = saturations,
};
- // clang-format on
for (size_t i = 0; i < MAX_ITEM_TYPE; i++)
rewards.items[i] = array_new(sizeof(char **), 16, cleanup_str_pointer);
return rewards;
diff --git a/analyzer/structures/array.c b/analyzer/structures/array.c
index ecdc0df..7c7d4f8 100644
--- a/analyzer/structures/array.c
+++ b/analyzer/structures/array.c
@@ -6,16 +6,13 @@
#include "utils/memory.h"
DynArray array_new(size_t el_size, size_t capacity, void (*el_cleanup)(void *el)) {
- // clang-format off
- DynArray array = {
+ return (DynArray){
.data = safe_malloc(capacity * el_size),
.el_size = el_size,
.count = 0,
.capacity = capacity,
- .el_cleanup = el_cleanup
+ .el_cleanup = el_cleanup,
};
- // clang-format on
- return array;
}
void *array_get(DynArray array, size_t index) {
diff --git a/analyzer/utils/tcp.c b/analyzer/utils/tcp.c
index add2a76..a5d0366 100644
--- a/analyzer/utils/tcp.c
+++ b/analyzer/utils/tcp.c
@@ -12,15 +12,12 @@
// initalize default TCP segment
TCPSegment new_segment() {
- // clang-format off
- TCPSegment segment = {
+ return (TCPSegment){
.payload = NULL,
.len = 0,
.seq = 0,
- .port = 0
+ .port = 0,
};
- // clang-format on
- return segment;
}
// segments compare function to use with heap
@@ -75,16 +72,13 @@ TCPSegment get_segment_from_packet(const byte_t *packet, const struct pcap_pkthd
}
TCPStream new_stream(ConnectionSource src) {
- // clang-format off
- TCPStream stream = {
+ return (TCPStream){
.bytes = array_new(1, INIT_STREAM_CAPACITY, NULL),
.seq = 0,
.port = 0,
.src = src,
- .pending = NULL
+ .pending = NULL,
};
- // clang-format on
- return stream;
}
void destroy_stream(TCPStream stream) {