Re: [AD] possible bug in override_config_file |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> Of course, but when I tried to duplicate the problem in a simple recipe,
> it turned out to be my code at fault. The problem was caused by me using
> both override_config_file() and, later on, override_config_data(), as
> follows:
>
> allegro_init();
> override_config_file("/path/to/overrides.cfg");
> std::string setting("[sound] \n flip_pan = 0");
> override_config_data(setting.c_str(), setting.length());
>
> After the call to override_config_data() the program "forgets" the values
> in overrides.cfg. I guess this is intended behaviour. Maybe it wouldn't
> hurt to spell this out in clear text in the docs, or maybe I just need a
> new brain. :)
I guess no one could have given a definitive answer as to whether the two
functions cancel each other before your test; now we know and it indeed
doesn't hurt to document that.
> BTW, I noticed that the code example in override_config_data() doc uses
> multiline string. AFAIK, that feature is deprecated, and if I'm wrong,
> it's still easy to miss the fact that it's a multiline string, and
> therefore not think you need to separate category and variable names using
> newlines. The attached patch (against 4.1.14) removes possible confusion.
Thanks.
Is the wording in the attached patch clear enough?
--
Eric Botcazou
--- /home/eric/cvs/allegro/docs/src/allegro._tx Sun May 16 07:08:43 2004
+++ allegro/docs/src/allegro._tx Wed May 19 07:35:29 2004
@@ -1543,11 +1543,14 @@
in bytes. Example:
<codeblock>
/* Force German as system language, Spanish keyboard map. */
- const char *override_data = "[system]
- language=DE
- keyboard=ES";
+ const char *override_data = "[system]\n"
+ "language=DE\n"
+ "keyboard=ES";
override_config_data(override_data, ustrsize(override_data));<endblock>
+ Note that this function and the previous one are mutually exclusive, i.e.
+ calling one will cancel the effects of the other.
+
@@void @push_config_state();
@xref pop_config_state, set_config_file, save_joystick_data
@eref exconfig