Skip to content

Commit 0a33365

Browse files
committed
leader: use MAX_SIZE for error in malloc operation allocation
1 parent 04d93bf commit 0a33365

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/network/leader.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <sys/types.h>
99
#include <unistd.h>
1010
#include <mpi.h>
11+
#include <stdint.h>
1112

1213
size_t get_message_size() {
1314
return (sizeof(unsigned short) * 3 + 2 * sizeof(size_t) + sizeof(enum operation));
@@ -107,7 +108,7 @@ size_t alloc_memory(size_t size, struct leader_resources *l_r) {
107108
struct allocation *a = malloc(32 + sizeof(struct allocation));
108109
a->number_parts = 0;
109110
a->parts = NULL;
110-
a->v_address_start = 99999999999;
111+
a->v_address_start = SIZE_MAX;
111112
ssize_t m_size = size;
112113
for (size_t i = 0; i < blks->nb_blocks; i++) {
113114
struct block *b = blks->blks[i];
@@ -118,7 +119,7 @@ size_t alloc_memory(size_t size, struct leader_resources *l_r) {
118119
if (m_size < 0) {
119120
b = split_block_u(b, -1 * m_size);
120121
}
121-
if (a->v_address_start == 99999999999)
122+
if (a->v_address_start == SIZE_MAX)
122123
a->v_address_start = b->virtual_address;
123124
a->number_parts++;
124125
a->parts = realloc(a->parts, 34 + (a->number_parts * sizeof(struct allocation *)));
@@ -131,7 +132,7 @@ size_t alloc_memory(size_t size, struct leader_resources *l_r) {
131132
return a->v_address_start;
132133
}
133134
}
134-
return 99999999999;
135+
return SIZE_MAX;
135136
}
136137

137138
struct address_search *search_at_address(size_t address, struct leader_resources *l_r) {

0 commit comments

Comments
 (0)