2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
5
<refentry id="glib-changes" revision="17 Jan 2002">
7
<refentrytitle>Changes to GLib</refentrytitle>
8
<manvolnum>3</manvolnum>
9
<refmiscinfo>Changes to GLib</refmiscinfo>
13
<refname>Changes to GLib</refname>
15
Incompatible changes made between successing versions of GLib
21
<title>Incompatible changes from 2.0 to 2.2</title>
27
GLib changed the seeding algorithm for the pseudo-random number
28
generator Mersenne Twister, as used by <structname>GRand</structname>
29
and <structname>GRandom</structname>. This was necessary, because some
30
seeds would yield very bad pseudo-random streams. Also the
31
pseudo-random integers generated by
32
<function>g_rand*_int_range()</function> will have a
33
slightly better equal distribution with the new version of GLib.
37
Further information can be found at the website of the Mersenne
38
Twister random number generator at <ulink
39
url="http://www.math.keio.ac.jp/~matumoto/emt.html">http://www.math.keio.ac.jp/~matumoto/emt.html</ulink>.
43
The original seeding and generation algorithms, as found in GLib
44
2.0.x, can be used instead of the new ones by setting the environment
45
variable <envar>G_RANDOM_VERSION</envar> to the value of '2.0'. Use
46
the GLib-2.0 algorithms only if you have sequences of numbers generated
47
with Glib-2.0 that you need to reproduce exactly.
57
<title>Incompatible changes from 1.2 to 2.0</title>
63
The event loop functionality <structname>GMain</structname> has extensively
64
been revised to support multiple separate main loops in separate threads.
65
All sources (timeouts, idle functions, etc.) are associated with a
66
<structname>GMainContext</structname>.
70
Compatibility functions exist so that most application code dealing with
71
the main loop will continue to work. However, code that creates new custom
72
types of sources will require modification.
76
The main changes here are:
82
Sources are now exposed as <type>GSource *</type>, rather than simply as
89
New types of sources are created by structure "derivation" from
90
<structname>GSource</structname>, so the <literal>source_data</literal>
91
parameter to the <structname>GSource</structname> virtual functions has been
92
replaced with a <type>GSource *</type>.
98
Sources are first created, then later added to a specific
99
<structname>GMainContext</structname>.
105
Dispatching has been modified so both the callback and data are passed
106
in to the <function>dispatch()</function> virtual function.
111
To go along with this change, the vtable for
112
<structname>GIOChannel</structname> has changed and
113
<function>add_watch()</function> has been replaced by
114
<function>create_watch()</function>.
120
<function>g_list_foreach()</function> and
121
<function>g_slist_foreach()</function> have been changed so they
122
are now safe against removal of the current item, not the next item.
126
It's not recommended to mutate the list in the callback to these
127
functions in any case.
133
<structname>GDate</structname> now works in UTF-8, not in the current locale.
134
If you want to use it with the encoding of the locale, you need to convert
135
strings using <function>g_locale_to_utf8()</function> first.
141
<function>g_strsplit()</function> has been fixed to:
146
include trailing empty tokens, rather than stripping them
151
split into a maximum of <literal>max_tokens</literal> tokens, rather
152
than <literal>max_tokens + 1</literal>
157
Code depending on either of these bugs will need to be fixed.
163
Deprecated functions that got removed:
164
<function>g_set_error_handler()</function>,
165
<function>g_set_warning_handler()</function>,
166
<function>g_set_message_handler()</function>, use
167
<function>g_log_set_handler()</function> instead.