X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsort.c;h=ac70da11814c3a92b659c40a86e918def89e65f5;hb=def7e6026513a3ee7c2b38416b30a2e890e34311;hp=5fd2eaec9e991129229f22e5a9deac913a0521a9;hpb=c87013b64d1731dac5da8f738ae8d1b4c1030a90;p=pspp-builds.git diff --git a/src/sort.c b/src/sort.c index 5fd2eaec..ac70da11 100644 --- a/src/sort.c +++ b/src/sort.c @@ -231,7 +231,7 @@ do_internal_sort (struct sort_cases_pgm *scp, int separate) if (case_cnt <= 0) return isrt; - if (case_cnt > set_max_workspace / sizeof *case_array) + if (case_cnt > get_max_workspace() / sizeof *case_array) goto error; case_list = storage_source_get_cases (vfm_source); @@ -780,7 +780,7 @@ allocate_cases (struct initial_run_state *irs) + sizeof *irs->free_list + irs->xsrt->scp->case_size + 4 * sizeof (void *)); - max_cases = set_max_workspace / approx_case_cost; + max_cases = get_max_workspace() / approx_case_cost; irs->records = malloc (sizeof *irs->records * max_cases); for (i = 0; i < max_cases; i++) { @@ -806,7 +806,7 @@ allocate_cases (struct initial_run_state *irs) msg (SE, _("Out of memory. Could not allocate room for minimum of %d " "cases of %d bytes each. (PSPP workspace is currently " "restricted to a maximum of %d KB.)"), - MIN_BUFFER_TOTAL_SIZE_RECS, approx_case_cost, set_max_workspace / 1024); + MIN_BUFFER_TOTAL_SIZE_RECS, approx_case_cost, get_max_workspace() / 1024); return 0; } return 1; @@ -1019,7 +1019,7 @@ merge (struct external_sort *xsrt) /* Allocate as many cases as possible into cases. */ approx_case_cost = (sizeof *mrg.cases + xsrt->scp->case_size + 4 * sizeof (void *)); - mrg.case_cnt = set_max_workspace / approx_case_cost; + mrg.case_cnt = get_max_workspace() / approx_case_cost; mrg.cases = malloc (sizeof *mrg.cases * mrg.case_cnt); if (mrg.cases == NULL) goto done; @@ -1037,7 +1037,7 @@ merge (struct external_sort *xsrt) msg (SE, _("Out of memory. Could not allocate room for minimum of %d " "cases of %d bytes each. (PSPP workspace is currently " "restricted to a maximum of %d KB.)"), - MIN_BUFFER_TOTAL_SIZE_RECS, approx_case_cost, set_max_workspace / 1024); + MIN_BUFFER_TOTAL_SIZE_RECS, approx_case_cost, get_max_workspace() / 1024); return 0; }