X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=storage.c;h=4a559f27433086ceda169ce7f734afffd8450157;hb=fdae2f232ae602b72dc09beaa7588d452e3faadc;hp=dda1856155387d8f8d5b5afbd9697eabfaee2215;hpb=893638e2b94ab197b883c748a0f6044ca78b2072;p=calc.git diff --git a/storage.c b/storage.c index dda1856..4a559f2 100644 --- 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)