projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
settings: Avoid using a pointer and global data for algorithms.
[pspp]
/
src
/
data
/
settings.c
diff --git
a/src/data/settings.c
b/src/data/settings.c
index a5fbfdecbda658eed3b16e94be686c62423cd485..551556f011cd89affcb3050042174948d73f268a 100644
(file)
--- a/
src/data/settings.c
+++ b/
src/data/settings.c
@@
-33,8
+33,6
@@
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
-static int global_algorithm = ENHANCED;
-
struct settings
{
/* Integer format used for IB and PIB input. */
struct settings
{
/* Integer format used for IB and PIB input. */
@@
-70,7
+68,7
@@
struct settings
bool testing_mode;
int cmd_algorithm;
bool testing_mode;
int cmd_algorithm;
- int
*
algorithm;
+ int
global_
algorithm;
int syntax;
struct fmt_settings *styles;
int syntax;
struct fmt_settings *styles;
@@
-110,7
+108,7
@@
static struct settings the_settings = {
{FMT_F, 8, 2}, /* default_format */
false, /* testing_mode */
ENHANCED, /* cmd_algorithm */
{FMT_F, 8, 2}, /* default_format */
false, /* testing_mode */
ENHANCED, /* cmd_algorithm */
-
&global_algorithm, /*
algorithm */
+
ENHANCED, /* global_
algorithm */
ENHANCED, /* syntax */
NULL, /* styles */
ENHANCED, /* syntax */
NULL, /* styles */
@@
-478,14
+476,14
@@
settings_set_testing_mode ( bool testing_mode)
enum behavior_mode
settings_get_algorithm (void)
{
enum behavior_mode
settings_get_algorithm (void)
{
- return
*the_settings.
algorithm;
+ return
the_settings.cmd_
algorithm;
}
/* Set the algorithm option globally. */
void
settings_set_algorithm (enum behavior_mode mode)
{
}
/* Set the algorithm option globally. */
void
settings_set_algorithm (enum behavior_mode mode)
{
-
global
_algorithm = mode;
+
the_settings.global_algorithm = the_settings.cmd
_algorithm = mode;
}
/* Set the algorithm option for this command only */
}
/* Set the algorithm option for this command only */
@@
-493,14
+491,13
@@
void
settings_set_cmd_algorithm ( enum behavior_mode mode)
{
the_settings.cmd_algorithm = mode;
settings_set_cmd_algorithm ( enum behavior_mode mode)
{
the_settings.cmd_algorithm = mode;
- the_settings.algorithm = &the_settings.cmd_algorithm;
}
/* Unset the algorithm option for this command */
void
unset_cmd_algorithm (void)
{
}
/* Unset the algorithm option for this command */
void
unset_cmd_algorithm (void)
{
- the_settings.
algorithm = &
global_algorithm;
+ the_settings.
cmd_algorithm = the_settings.
global_algorithm;
}
/* Get the current syntax setting */
}
/* Get the current syntax setting */