diff options
| -rw-r--r-- | analyzer/analyzer.c | 4 | ||||
| -rw-r--r-- | analyzer/structures/array.c | 7 | ||||
| -rw-r--r-- | analyzer/utils/tcp.c | 14 |
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) { |
