From 620909b626a5083fb2211ff42f879b78765656bd Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Wed, 12 Aug 2020 16:35:02 +0100
Subject: [PATCH] updated src to be more clear

---
 src/binary_c_python_api.c | 56 ++++++++++++++++++++++++++++++++-------
 1 file changed, 47 insertions(+), 9 deletions(-)

diff --git a/src/binary_c_python_api.c b/src/binary_c_python_api.c
index 01fc7438e..3f0938d0b 100644
--- a/src/binary_c_python_api.c
+++ b/src/binary_c_python_api.c
@@ -116,9 +116,15 @@ int run_system(char * argstring,
     
     /* set raw_buffer_size = -1 to prevent it being freed */
     stardata->tmpstore->raw_buffer_size = -1;
-    
+
     /* free stardata (except the buffer) */
-    binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE); // CHeck if this is good for single runs.. TODO: 
+    binary_c_free_memory(&stardata, // Stardata
+        TRUE,                       // free_preferences
+        TRUE,                       // free_stardata
+        FALSE,                      // free_store
+        FALSE                       // free_raw_buffer
+    );
+
 
     // add flag or logic to free store contents.
     if (store_memaddr == -1)
@@ -177,9 +183,16 @@ int return_arglines(char ** const buffer,
     
     /* set raw_buffer_size = -1 to prevent it being freed */
     stardata->tmpstore->raw_buffer_size = -1;
-    
+
     /* free stardata (except the buffer) */
-    binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE);
+    binary_c_free_memory(&stardata, // Stardata
+        TRUE,                       // free_preferences
+        TRUE,                       // free_stardata
+        FALSE,                      // free_store
+        FALSE                       // free_raw_buffer
+    );
+    
+    // TODO: check what this does
     binary_c_free_store_contents(store);
 
     return 0;
@@ -221,7 +234,14 @@ int return_help_info(char * argstring,
     stardata->tmpstore->raw_buffer_size = -1;
     
     /* free stardata (except the buffer) */
-    binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE);
+    binary_c_free_memory(&stardata, // Stardata
+        TRUE,                       // free_preferences
+        TRUE,                       // free_stardata
+        FALSE,                      // free_store
+        FALSE                       // free_raw_buffer
+    );
+
+    // Ask rob whether this can be replaced with setting the thing above to true
     binary_c_free_store_contents(store);
     return 0;
 }
@@ -262,7 +282,14 @@ int return_help_all_info(char ** const buffer,
     stardata->tmpstore->raw_buffer_size = -1;
     
     /* free stardata (except the buffer) */
-    binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE);
+    binary_c_free_memory(&stardata, // Stardata
+        TRUE,                       // free_preferences
+        TRUE,                       // free_stardata
+        FALSE,                      // free_store
+        FALSE                       // free_raw_buffer
+    );
+
+
     binary_c_free_store_contents(store);
     return 0;
 }
@@ -301,9 +328,15 @@ int return_version_info(char ** const buffer,
     
     /* set raw_buffer_size = -1 to prevent it being freed */
     stardata->tmpstore->raw_buffer_size = -1;
-    
+
     /* free stardata (except the buffer) */
-    binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,FALSE);
+    binary_c_free_memory(&stardata, // Stardata
+        TRUE,                       // free_preferences
+        TRUE,                       // free_stardata
+        FALSE,                      // free_store
+        FALSE                       // free_raw_buffer
+    );
+
     binary_c_free_store_contents(store);
     return 0;
 }
@@ -344,7 +377,12 @@ long int return_store(char * argstring,
     stardata->tmpstore->raw_buffer_size = -1;
     
     /* free stardata (except the buffer) */
-    binary_c_free_memory(&stardata, TRUE, TRUE, FALSE, FALSE);
+    binary_c_free_memory(&stardata, // Stardata
+        TRUE,                       // free_preferences
+        TRUE,                       // free_stardata
+        FALSE,                      // free_store
+        FALSE                       // free_raw_buffer
+    );
 
     /* convert the pointer */ 
     uintptr_t store_memaddr_int = (uintptr_t)store; // C Version converting ptr to int
-- 
GitLab