X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fsettings.c;h=c86ac9cc7e2c856ee685d271cf0995e5a9bbafd1;hb=b5c82cc9aabe7e641011130240ae1b2e84348e23;hp=ad509fb028059a6c6d3af86445a1bdb9e744ce08;hpb=9a331fe64eb814ae5c1322e21717a04fb254bf65;p=pspp-builds.git diff --git a/src/data/settings.c b/src/data/settings.c index ad509fb0..c86ac9cc 100644 --- a/src/data/settings.c +++ b/src/data/settings.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,11 +22,13 @@ #include "format.h" #include "value.h" #include "xalloc.h" +#include #include #include #include #include "error.h" +#include "minmax.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -147,7 +149,6 @@ settings_init (int *width, int *length) { init_viewport (width, length); settings_set_epoch (-1); - i18n_init (); the_settings.styles = fmt_create (); settings_set_decimal_char (get_system_decimal ()); @@ -157,7 +158,6 @@ void settings_done (void) { fmt_done (the_settings.styles); - i18n_done (); } /* Returns the floating-point format used for RB and RBHEX @@ -517,13 +517,12 @@ settings_get_workspace (void) } /* Approximate maximum number of cases to allocate in-core, given - that each case contains VALUE_CNT values. */ + that each case has the format given in PROTO. */ size_t -settings_get_workspace_cases (size_t value_cnt) +settings_get_workspace_cases (const struct caseproto *proto) { - size_t case_size = sizeof (union value) * value_cnt + 4 * sizeof (void *); - size_t case_cnt = MAX (settings_get_workspace () / case_size, 4); - return case_cnt; + size_t n_cases = settings_get_workspace () / case_get_cost (proto); + return MAX (n_cases, 4); } /* Set approximate maximum amount of memory to use for cases, in