Commit Graph

11292 Commits

Author SHA1 Message Date
Ryan Lortie
dd09a95543 Add GPrivate destroy notify testcase
Ensure that GPrivate destroy notifies are properly called.

This test currently fails on win32 (where we are leaking).

https://bugzilla.gnome.org/show_bug.cgi?id=660745
2011-10-04 16:02:16 -04:00
Ryan Lortie
2e5cb6f522 win32 fixes from g_thread_init() deprecation
I can't even begin to imagine how these fell through the cracks...
2011-10-04 15:44:48 -04:00
Ryan Lortie
1bf01efb9f gitignore 2011-10-04 15:34:15 -04:00
Ryan Lortie
47444dacc0 Deprecate g_thread_init()
Move the last few things that needed thread-safe initialisation to a
global ctor.

https://bugzilla.gnome.org/show_bug.cgi?id=660744
2011-10-04 15:31:49 -04:00
Ryan Lortie
310c3ed4cc Clean up process of calling g_debug_init()
Make sure that it calls absolutely nothing that may ever recurse back
into GLib again:

  - g_ascii_strcasecmp() is unsafe because it has g_return_if_fail() at
    the top.  As far as I know, the only ASCII character letter that
    would get special treatment here is "i" and that appears in neither
    "help" nor "all".

  - g_getenv() is very complicated on Windows, so use a simple version
    that is sufficient for our purposes.

Now that it's completely safe, we can just call it from g_logv() in the
usual way without all of the hacks.

https://bugzilla.gnome.org/show_bug.cgi?id=660744
2011-10-04 15:31:49 -04:00
Dan Winship
1481b7bca3 Add _g_io_module_get_default(), use to simplify other *_get_default()s
Add _g_io_module_get_default(), which implements the
figure-out-the-best-available-module-that-is-actually-usable logic,
and use that to simplify g_proxy_resolver_get_default(),
g_settings_backend_get_default(), g_tls_backend_get_default(), and
g_vfs_get_default().

https://bugzilla.gnome.org/show_bug.cgi?id=620932
2011-10-04 13:20:34 -04:00
Dan Winship
38d21f6d8a gsettingsbackend: remove useless check
GMemorySettingsBackend is always present, so there's no need to check
for "no backends available"

https://bugzilla.gnome.org/show_bug.cgi?id=620932
2011-10-04 13:20:28 -04:00
Dan Winship
afa604f881 gio/tests/socket-client: fix a crash (and some indentation) 2011-10-04 13:19:21 -04:00
Chun-wei Fan
53fb4e9867 Bug 660851: Update GIO for changes in GThread API
gsocket.c: Use intern string instead of GStaticPrivate/
           g_static_private_set, as Dan suggested.
2011-10-05 00:57:34 +08:00
Bastien Nocera
82fae72ae9 [gio] Improve doc for g_file_make_directory_with_parents()
g_file_make_directory_with_parents() will fail for already
existing directories, unlike g_mkdir_with_parents(), so mention
this clearly in the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=660791
2011-10-04 17:10:39 +01:00
Ryan Lortie
449a1e8bfd Fix an invalid non-looping use of GCond
The GIOScheduler was using a GCond in a way that didn't deal with the
possibility of spurious wakeups.  Add an explicit predicate and a loop.

Problem caught by Matthias Clasen.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:57:35 -04:00
Ryan Lortie
c474cd71ba GIO: switch a couple more GMutex users to _init()
Move a couple more GIO users off of _new()/_free() to _init()/_clear().

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:57:34 -04:00
Ryan Lortie
e517fb6cb0 Make G_ASSERT_STATIC work with clang
A simplified variant of an approach proposed by Behdad.

https://bugzilla.gnome.org/show_bug.cgi?id=660413
2011-10-04 11:52:47 -04:00
Ryan Lortie
7d4dea748d GDBus codegen: generate code with embedded GMutex
Modify GDBus code generator to emit code that uses GMutex embedded into
the structure of the skeleton instead of a pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:47 -04:00
Ryan Lortie
8bcdabf25a GThreadedResolver: port to embedded GMutex/GCond
This is the only case that was non trivial to port, due to some of the
logic being based on checking the GCond* for being non-%NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:46 -04:00
Ryan Lortie
518feb45eb GMain, ThreadPool: embed GCond in struct
Use an embedded GCond and g_cond_init()/clear() instead of a pointer
with g_cond_new() and _free().

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:46 -04:00
Ryan Lortie
19cd57d4f3 GCancellable: use GCond and GMutex directly
Use a statically-allocated GCond and directly use GMutex instead of
making use of the undocumented G_LOCK_NAME() macro.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:46 -04:00
Ryan Lortie
5f48e2cde5 GDBus: switch to struct-embedded GMutex and GCond
Now that we have those, we should use them.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:46 -04:00
Chun-wei Fan
e03db42792 gstringchunk.c: Include gutils.h
This is due to usage of the inline keyword which may not be universally
defined unless guils.h is included.
2011-10-04 23:08:12 +08:00
Ryan Lortie
13bd399d0a Add README notes about recent changes 2011-10-04 11:00:31 -04:00
Ryan Lortie
794c1a30bc macro wrappers for g_once_init_enter/leave
Give the macro wrapper treatment to g_once_init_enter() and leave() in
the same style that we did for gatomic.

It is now possible to use these macros with any pointer-sized object,
and not just gsize.  The leave() macro ensures that the initialisation
result is a compatible type with the pointer that it is being written
to.

Just like with gatomic, there could be problems caused by use of (void*)
casts.  We'll see how that goes, and reevaluate if necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=660743
2011-10-04 11:00:31 -04:00
Antoine Jacoutot
8f58c2c0c4 Fix DATADIRNAME on OpenBSD.
On OpenBSD translation files are always installed under PREFIX/share/locale,
there is no such thing as PREFIX/lib/locale; according to that, set
DATADIRNAME to "share".
2011-10-04 16:30:18 +02:00
Ryan Lortie
037c91f845 rec-mutex testcase: add a performance test
Add a reasonable performance test for uncontended and contended cases at
different levels of recursion depth.
2011-10-04 09:45:36 -04:00
Simon McVittie
7973d9f8ba In the GVariant intro, mention lack of built-in endianness, and rationale
Presumably, the rationale for not storing the endianness is that
GVariant is a recursive type system, and in a sane format, endianness
only needs to be stored once per blob of data (once per D-Bus message,
once per file on disk, etc.).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=632049
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2011-10-04 12:39:24 +01:00
Simon McVittie
ebb544f549 g_variant_get_data: mention what you need to know to deserialise
Also include a shorter version in the docs for g_variant_store, with a
pointer to g_variant_get_data.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=632049
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2011-10-04 12:39:22 +01:00
Simon McVittie
3869e40ac3 g_variant_new_from_data: mention that the caller might need to byteswap
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=632049
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2011-10-04 12:39:15 +01:00
Simon McVittie
3d7264ce70 Fix a typo in describing GVariant serialisation functions
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=632049
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2011-10-04 12:39:08 +01:00
Simon McVittie
83afcc0a29 Escape percent sign in g_variant_new_parsed documentation
Strings matching /%[a-z]/ are special syntax for gtk-doc.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=632049
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2011-10-04 12:38:32 +01:00
Simon McVittie
d34c9bc6f3 g_variant_get_fixed_array: document which types are appropriate
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=632049
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2011-10-04 12:38:30 +01:00
Simon McVittie
9e827ab615 GVariant docs: be clear that the serialisation format isn't the same as D-Bus
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=632049
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2011-10-04 12:38:20 +01:00
Simon McVittie
f778564ba2 Be clear that g_str_hash etc. don't accept NULL
This covers the str, double, int, int64 hash and equal functions, but not
anything that takes an "object", since the convention is that "object
methods" never accept NULL anyway.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=592715
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-10-04 09:48:35 +01:00
Simon McVittie
34a1224549 Be completely clear about what g_direct_hash, g_direct_equal do
Also annotate them as (allow-none), more for the benefit of gtk-doc
readers than introspection.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=592715
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-10-04 09:44:27 +01:00
Simon McVittie
06c96ab1e5 GHashTable: be more clear what g_int_hash wants
Using g_int_hash, g_int_equal with keys like GINT_TO_POINTER (n) seems to
be a reasonably common GLib-novice mistake. It doesn't help that the
documentation for GHashFunc was ambiguous about this.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=592715
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-10-04 09:42:28 +01:00
Simon McVittie
5bed8317ea Warn when classes/instances exceed the allowed size, if possible
It's impossible to check this if the library user is using
g_type_register_static, but in that case their compiler should hopefully
warn about the truncation. This fixes it for G_DEFINE_TYPE and friends,
at least.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=659916
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-10-04 09:35:54 +01:00
Chun-wei Fan
29a71915d8 Update glibconfig.h.win32(.in)
Update typedef of GStaticMutex here to match the typedef of GMutex
in glib/gthread.h (due to commit c5634df6)
2011-10-04 14:06:10 +08:00
Matthias Clasen
ca6a985039 Improve test coverage in the thread tests
Use g_thread_new_full() in some places.
2011-10-04 00:46:10 -04:00
Matthias Clasen
e6fa27a5f8 Improve test coverage in the GString tests 2011-10-04 00:45:42 -04:00
Matthias Clasen
fc32480658 Improve testcoverage in the rec-mutex test
Test g_rec_mutex_trylock() in both locked and unlocked cases.
2011-10-04 00:44:58 -04:00
Matthias Clasen
823e32655e Add a few more tests
This brings test coverage for glist.c and glist.c to the
coveted 100% lines mark.
2011-10-03 23:55:02 -04:00
Matthias Clasen
1fe4429318 Remove bits of dead code identified by coverage tests
These lines could were not hit by our tests, and examination
of the code reveals that they can't ever be hit.
2011-10-03 23:54:08 -04:00
Matthias Clasen
b74f46db6b Add some more thread tests 2011-10-03 22:25:47 -04:00
Ryan Lortie
070aefcf59 GAsyncQueue: properly set free function
The copying of code from g_async_queue_new() to g_async_queue_new_full()
in ef08aa786b copied the setting of the
free function to NULL (instead of the one passed in by the user).

Fix that up so that the test passes again.

https://bugzilla.gnome.org/show_bug.cgi?id=660843
2011-10-03 22:18:01 -04:00
David Zeuthen
3f982cb9ab GUnixMountPoint: expose options
Make the options from an /etc/fstab entry available as public API -
this can be used to support options such as

 comment=gvfs.name=Foo\040Bar

to e.g. set the name of an fstab mount in the UI to "Foo Bar".

https://bugzilla.gnome.org/show_bug.cgi?id=660536

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-03 14:06:47 -04:00
Ryan Lortie
3106391694 Revert "GSettings: don't abort on missing schemas"
This reverts commit c841c2ce3f.

This approach has been an unmitigated disaster.  We're getting all sorts
of crashes due to functions that are returning NULL because they can't
find the schema for the default value.  The people who get these crashes
are then confused about the root cause of the problem and waste a lot of
time trying to figure it out.

Until we find a better solution, we should go back to what we had
before.

https://bugzilla.gnome.org/show_bug.cgi?id=655366
2011-10-03 10:19:38 -04:00
Matthias Clasen
9d989c7b8a Cosmetics 2011-10-02 23:53:56 -04:00
Matthias Clasen
fa6710ab6f Documentation fixes 2011-10-02 23:43:45 -04:00
Matthias Clasen
65b84bb7d0 Fix doc build
The markup here was not only broken, it was also unnecessary,
since gtk-doc knows to apply <function></function> tags to things
that end with () already.
2011-10-02 23:43:45 -04:00
Ryan Lortie
65056180dd locks: Add initialisation notes
For each of the 4, mention that static storage or _init() is needed.
2011-10-02 23:37:20 -04:00
Ryan Lortie
c5634df6d3 locks: change the ABI just a bit
Add a little bit more room in the ABI for our synchronisation primatives
since we're going to need it when we add native implementations on
Linux.

Also: rename the pointer field and add /*< private >*/ annotations.
2011-10-02 22:33:11 -04:00
Ryan Lortie
2a677d1370 locks: drop _INIT macros
All locks are now zero-initialised, so we can drop the G_*_INIT macros
for them.

Adjust various users around GLib accordingly and change the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
2011-10-02 22:33:10 -04:00