Skip to content

Commit 5e9d5d4

Browse files
committed
Removed unnecessary copies in validation list | Only optimization is bringing the indexed column (C0) in front
1 parent 2136436 commit 5e9d5d4

File tree

3 files changed

+106
-191
lines changed

3 files changed

+106
-191
lines changed

src/main.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ int main(int argc, char **argv) {
3434
// printf("HEAD LEN %u \t| HEAD TYPE %u \t| DESC ", head.messageLen, head.type);
3535

3636
/* Retrieve the message body */
37-
if (body != NULL)
38-
free(body);
37+
// if (body != NULL)
38+
// free(body);
3939
if (head.messageLen > 0 ) {
4040
body = malloc(head.messageLen * sizeof(char));
4141
if (read(0, body, head.messageLen) <= 0) {
@@ -47,23 +47,32 @@ int main(int argc, char **argv) {
4747
// And interpret it
4848
switch (head.type) {
4949
case Done:
50+
// validationListPrint(validation_list);
5051
destroySchema(journal_array, relation_count);
5152
validationListDestroy(validation_list);
5253
return EXIT_SUCCESS;
5354
case DefineSchema:
5455
journal_array = processDefineSchema(body, &relation_count, tid_mode);
56+
if (body != NULL)
57+
free(body);
5558
break;
5659
case Transaction:
5760
processTransaction(body,journal_array);
61+
if (body != NULL)
62+
free(body);
5863
break;
5964
case ValidationQueries:
6065
processValidationQueries(body,journal_array,validation_list);
6166
break;
6267
case Flush:
6368
processFlush(body,journal_array,validation_list);
69+
if (body != NULL)
70+
free(body);
6471
break;
6572
case Forget:
6673
processForget(body,journal_array);
74+
if (body != NULL)
75+
free(body);
6776
break;
6877
default:
6978
exit(EXIT_FAILURE); // crude error handling, should never happen

0 commit comments

Comments
 (0)