change perl program calls
[calc.git] / storage.c
index dda1856155387d8f8d5b5afbd9697eabfaee2215..4a559f27433086ceda169ce7f734afffd8450157 100644 (file)
--- a/storage.c
+++ b/storage.c
@@ -16,11 +16,15 @@ tab_t *storage = NULL;
 
 /* storage functions */
 
-void memory (int nb)
+int memory (int nb)
 {
-    if (nb != size_tab (storage)) {
+    if ((nb != -1) && (nb != size_tab (storage))) {
         storage = resize_tab (storage, nb);
     }
+    if (size_tab (storage) == -1) {
+        memory (DEFAULT_STORAGE_SIZE);
+    }
+    return size_tab (storage);
 }
 
 double store (int id, double value)