platform/upstream/glib.git
13 years agoGStaticMutex: ABI fixup
Ryan Lortie [Mon, 10 Oct 2011 17:13:31 +0000 (13:13 -0400)]
GStaticMutex: ABI fixup

Everything was OK as long as GMutex was backed by pthread_mutex_t on
POSIX.  Since this is no longer the case, the ABI of GStaticMutex was
broken.

Fix that up by using pthread_mutex_t directly in the structure.  Since
that's potentially incompatible with our GMutex implementation, set
g_thread_use_default_impl to FALSE to cause the fallback code (which
manually allocates a GMutex) to run, even in the case of
already-existing code (without the need for a recompile).  This will
cause the pthread_mutex_t part of the struct to be completely ignored.

13 years agoCompile private test with -pthread on UNIX
Matthias Clasen [Mon, 10 Oct 2011 15:10:20 +0000 (11:10 -0400)]
Compile private test with -pthread on UNIX

We are using explicit pthread calls here, so we should
use the right linker flags for that.

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

13 years agoDon't use deprecated GThread API in gio tests
Matthias Clasen [Mon, 10 Oct 2011 13:49:50 +0000 (09:49 -0400)]
Don't use deprecated GThread API in gio tests

13 years agoUpdated Norwegian bokmål translation
Kjartan Maraas [Mon, 10 Oct 2011 05:53:16 +0000 (07:53 +0200)]
Updated Norwegian bokmål translation

13 years agoUpdated Lithuanian translation
Algimantas Margevičius [Sun, 9 Oct 2011 19:00:49 +0000 (22:00 +0300)]
Updated Lithuanian translation

13 years agoSilence deprecation warnings in deprecated/
Matthias Clasen [Sun, 9 Oct 2011 13:57:13 +0000 (09:57 -0400)]
Silence deprecation warnings in deprecated/

We know we are all deprecated here...

13 years agoAdd G_GNUC_DEPRECATED to deprecated functions in gio
Matthias Clasen [Sun, 9 Oct 2011 03:49:04 +0000 (23:49 -0400)]
Add G_GNUC_DEPRECATED to deprecated functions in gio

13 years agoAdd G_GNUC_DEPRECATED to deprecated functions in gobject
Matthias Clasen [Sun, 9 Oct 2011 03:23:43 +0000 (23:23 -0400)]
Add G_GNUC_DEPRECATED to deprecated functions in gobject

13 years agoAdd G_GNUC_DEPRECATED to deprecated APIs in glib
Matthias Clasen [Sun, 9 Oct 2011 03:16:01 +0000 (23:16 -0400)]
Add G_GNUC_DEPRECATED to deprecated APIs in glib

13 years agoAdd some GHookList tests
Matthias Clasen [Sat, 8 Oct 2011 16:43:12 +0000 (12:43 -0400)]
Add some GHookList tests

13 years agoTest a few more GIOChannel functions
Matthias Clasen [Sat, 8 Oct 2011 16:42:41 +0000 (12:42 -0400)]
Test a few more GIOChannel functions

13 years agoRemove a bit of dead code
Matthias Clasen [Sat, 8 Oct 2011 16:42:06 +0000 (12:42 -0400)]
Remove a bit of dead code

13 years agoPass G_DEBUG=g-gc-friendly when running the tests
Matthias Clasen [Sat, 8 Oct 2011 16:41:38 +0000 (12:41 -0400)]
Pass G_DEBUG=g-gc-friendly when running the tests

13 years agoAdd some more GMarkup tests
Matthias Clasen [Thu, 6 Oct 2011 13:01:24 +0000 (09:01 -0400)]
Add some more GMarkup tests

13 years agoCall setlocale in markup-parse test
Matthias Clasen [Thu, 6 Oct 2011 12:59:51 +0000 (08:59 -0400)]
Call setlocale in markup-parse test

This is necessary to make utf-8 text come out properly.

13 years agoImprove GNode test coverage
Matthias Clasen [Thu, 6 Oct 2011 03:36:35 +0000 (23:36 -0400)]
Improve GNode test coverage

13 years agoImprove GCache test coverage
Matthias Clasen [Thu, 6 Oct 2011 03:31:14 +0000 (23:31 -0400)]
Improve GCache test coverage

13 years agoImprove coverage of string function tests
Matthias Clasen [Thu, 6 Oct 2011 03:24:27 +0000 (23:24 -0400)]
Improve coverage of string function tests

13 years agoImprove coverage of GHmac tests
Matthias Clasen [Thu, 6 Oct 2011 03:24:08 +0000 (23:24 -0400)]
Improve coverage of GHmac tests

13 years agoAdd a test for g_date_time_new_from_timeval_utc
Matthias Clasen [Thu, 6 Oct 2011 03:00:09 +0000 (23:00 -0400)]
Add a test for g_date_time_new_from_timeval_utc

13 years agogio: enable test_peer regression test for OpenBSD
Antoine Jacoutot [Sat, 8 Oct 2011 09:47:20 +0000 (11:47 +0200)]
gio: enable test_peer regression test for OpenBSD

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

13 years agoGDBusConnection: Make pending calls error when the connection is lost
David Zeuthen [Fri, 7 Oct 2011 18:20:03 +0000 (14:20 -0400)]
GDBusConnection: Make pending calls error when the connection is lost

If the connection to the bus is lost while a method call is ongoing,
the method call does not get cancelled. Instead it just sits around
until it times out.

This is visible here on XO laptops when stopping the display manager
during shutdown. imsettings starts sending a sync message to give up
its bus name (via g_bus_unown_name()), then systemd terminates the
session bus at approximately the same time. imsettings then hangs for
about 20 seconds before timing out the message.

 http://lists.freedesktop.org/archives/dbus/2011-September/014717.html

imsettings behaviour could be improved as described in that thread,
but I think this is a glib bug. I've also come up with the attached
patch which fixes it.

Credits for the bug-fix goes to Daniel Drake <dsd@laptop.org>. The test
case was written by David Zeuthen <zeuthen@gmail.com>.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoBug 661129: Duplicate symbols zero_thread and g_once_mutex on OSX
John Ralls [Fri, 7 Oct 2011 16:51:04 +0000 (09:51 -0700)]
Bug 661129: Duplicate symbols zero_thread and g_once_mutex on OSX

13 years agoAdd g_main_context_ref_thread_default()
Dan Winship [Wed, 5 Oct 2011 14:46:57 +0000 (10:46 -0400)]
Add g_main_context_ref_thread_default()

Add g_main_context_ref_thread_default(), which always returns a
reffed GMainContext, rather than sometimes returning a (non-reffed)
GMainContext, and sometimes returning NULL. This simplifies the
bookkeeping in any code that needs to keep a reference to the
thread-default context for a while.

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

13 years agoUpdated Spanish translation
Daniel Mustieles [Fri, 7 Oct 2011 08:14:10 +0000 (10:14 +0200)]
Updated Spanish translation

13 years agoUSE __COUNTER__ instead of __LINE__ when available
Matthias Clasen [Fri, 7 Oct 2011 05:19:15 +0000 (01:19 -0400)]
USE __COUNTER__ instead of __LINE__ when available

I've seen builds fail with

nm-connection.c:119:691: error: declaration of '_GStaticAssertCompileTimeAssertion_119' shadows a previous local [-Werror=shadow]

because several compile-time assertions ended up on the same
line. __COUNTER__ is meant specifically for the purpose of
constructing identifiers, so use it when available.

13 years agoDon't redundantly redeclare
Matthias Clasen [Fri, 7 Oct 2011 04:42:52 +0000 (00:42 -0400)]
Don't redundantly redeclare

It makes gcc throw an error:

redundant redeclaration of 'g_static_mutex_get_mutex_impl' [-Werror=redundant-decls]

13 years agoMove G_LOCK below GMutex in the docs
Ryan Lortie [Thu, 6 Oct 2011 16:24:21 +0000 (12:24 -0400)]
Move G_LOCK below GMutex in the docs

The flow is currently a bit wrong since G_LOCK makes reference to GMutex
which was not yet defined, so switch things around.

13 years ago.gitignore
Ryan Lortie [Thu, 6 Oct 2011 16:21:33 +0000 (12:21 -0400)]
.gitignore

13 years agoSeveral docs cleanups
Ryan Lortie [Thu, 6 Oct 2011 16:19:58 +0000 (12:19 -0400)]
Several docs cleanups

13 years agoCleanup thread documentation
Ryan Lortie [Thu, 6 Oct 2011 16:01:53 +0000 (12:01 -0400)]
Cleanup thread documentation

13 years agogobjet/gclosure.c: Fix styling issues
Chun-wei Fan [Thu, 6 Oct 2011 08:02:18 +0000 (16:02 +0800)]
gobjet/gclosure.c: Fix styling issues

...so that it looks more consistent with the rest.

13 years agogobject/gclosure.c: Add type cast for int_val = value
Chun-wei Fan [Thu, 6 Oct 2011 07:37:52 +0000 (15:37 +0800)]
gobject/gclosure.c: Add type cast for int_val = value

This will silence compiler warnings on Visual C++.

(Sorry for the bad fix just now.)

13 years agoRevert "gobject/gclosure.c: Made up for missed pointer deref"
Chun-wei Fan [Thu, 6 Oct 2011 07:33:34 +0000 (15:33 +0800)]
Revert "gobject/gclosure.c: Made up for missed pointer deref"

This reverts commit d792a1ebe445cfab942ee9e079daa3b87bd60304.

13 years agogobject/gclosure.c: Made up for missed pointer deref
Chun-wei Fan [Thu, 6 Oct 2011 07:24:08 +0000 (15:24 +0800)]
gobject/gclosure.c: Made up for missed pointer deref

The value parameter is a gpointer * (void **), but ffi_arg itself is not a
pointer type, so make up for dereference here.

13 years agogthread-deprecated.c: Include gutils.h
Chun-wei Fan [Thu, 6 Oct 2011 07:12:22 +0000 (15:12 +0800)]
gthread-deprecated.c: Include gutils.h

This is needed for declaration of inline.

13 years agoconfig.h.win32(.in): Update for strcasecmp
Chun-wei Fan [Thu, 6 Oct 2011 07:02:54 +0000 (15:02 +0800)]
config.h.win32(.in): Update for strcasecmp

Visual C++ uses _stricmp, which is identical to strcasecmp on gcc.

13 years agoUpdate threads docs for the demise of g_thread_init()
Matthias Clasen [Thu, 6 Oct 2011 02:43:22 +0000 (22:43 -0400)]
Update threads docs for the demise of g_thread_init()

13 years agoRemove mention of gthread-2.0.pc from 'Compiling' section
Matthias Clasen [Thu, 6 Oct 2011 02:31:17 +0000 (22:31 -0400)]
Remove mention of gthread-2.0.pc from 'Compiling' section

At the same time, add one or two other corrections.

13 years agoAdd a warning to g_thread_init_with_errorcheck_mutexes
Matthias Clasen [Thu, 6 Oct 2011 02:23:25 +0000 (22:23 -0400)]
Add a warning to g_thread_init_with_errorcheck_mutexes

Should anybody try to use this, we should at least tell them that
its gone.

13 years agoclosure: fix handling of ENUMs and integral return types on 64-bit BE platforms
Dan Williams [Fri, 23 Sep 2011 17:32:23 +0000 (12:32 -0500)]
closure: fix handling of ENUMs and integral return types on 64-bit BE platforms

enums are stored in v_long but need to be marshalled as signed
integers.  On platforms where int is 32 bits, taking the
address of v_long resulted in the wrong 32 bits being marshalled.
So we need to stuff the enum's int-sized value to a temporary
int-sized variable and marshall that instead.

Second, on return, libffi actually returns a pointer to a value
that's sized according to platform conventions, not according to
what the caller requested.  ie if ffi_type_sint was requested, the
value can still be a 64-bit sign-extended long on a 64-bit
architecture like PPC64, thus the caller cannot simply cast
the return value as a pointer to the desired type, but must cast
as a pointer to an integral type and then cast to the desired
type to remove any sign extension complications.

For more information on how to correctly handle libffi return
values, see the following bug, specifically comment 35:

https://bugzilla.redhat.com/show_bug.cgi?id=736489

"For 64-bit ABIs that extend integral returns types to 64-bits, libffi always
returns full 64-bit values that you can truncate in the calling code.   It's
just the way it is has always been.  Please don't change libffi.  I'll document
this clearly for the next version (perhaps there is a mention of this, I
haven't looked yet).

The same is true for returning 8-bit values, for instance, on 32-bit systems.
All ABIs extend those results to the full 32-bits so you need to provide a
properly aligned buffer that's big enough to hold the result."

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

13 years agogmacros: Hide G_STATIC_ASSERT from g-ir-scanner
Colin Walters [Wed, 5 Oct 2011 15:27:45 +0000 (11:27 -0400)]
gmacros: Hide G_STATIC_ASSERT from g-ir-scanner

The C syntax here is twisted and confuses the scanner.  We don't
need to see it, so let's just skip it.

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

13 years agoBe sure to #include "gutils.h" in gbacktrace.c
Ryan Lortie [Wed, 5 Oct 2011 17:16:05 +0000 (13:16 -0400)]
Be sure to #include "gutils.h" in gbacktrace.c

0e3f530185d494dbb9db1b47f72f10f3ae598564 introduced a compiler warning
about implicit declaration of g_get_prgname().  Fix that.

Problem caught and fix suggested by Rico Tzschichholz.

13 years agoGDBus: Regenerate code when the codegen or options passed to it changes
David Zeuthen [Wed, 5 Oct 2011 16:33:55 +0000 (12:33 -0400)]
GDBus: Regenerate code when the codegen or options passed to it changes

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoFix up some doc comments that referred to threads not being enabled
Dan Winship [Wed, 5 Oct 2011 15:45:51 +0000 (11:45 -0400)]
Fix up some doc comments that referred to threads not being enabled

(and a few other unrelated comment fixes)

13 years agoGDBus: disable two more GDBus tests using fork()
David Zeuthen [Wed, 5 Oct 2011 14:56:11 +0000 (10:56 -0400)]
GDBus: disable two more GDBus tests using fork()

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusProxy: Correctly handle unknown members when having an expected interface
David Zeuthen [Tue, 4 Oct 2011 15:37:16 +0000 (11:37 -0400)]
GDBusProxy: Correctly handle unknown members when having an expected interface

Since it is valid for a D-Bus interface / service to add new methods,
signals or properties we must NEVER warn about unknown properties or
drop unknown signals or disallow unknown method invocations when we
have an expected interface.

So this means that the expected_interface machinery is only useful for
checking that the service didn't break ABI.

Also update the docs so it is clear exactly what it means to have an
expected interface.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agogthreadedresolver: remove a bit of cruft
Dan Winship [Wed, 5 Oct 2011 12:36:03 +0000 (08:36 -0400)]
gthreadedresolver: remove a bit of cruft

Remove a test that only made sense when GThreadedResolver was the base
class for the two non-threaded resolver classes that no longer exist.

13 years agoRemove cruft from g_strerror and g_strsignal
Matthias Clasen [Tue, 4 Oct 2011 05:25:26 +0000 (01:25 -0400)]
Remove cruft from g_strerror and g_strsignal

We can just assume that strerror/strsignal are available
nowadays. At the same time, drop use of thread-private storage.
Instead, always return interned strings.

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

13 years agoMisc test coverage improvements
Matthias Clasen [Wed, 5 Oct 2011 05:04:42 +0000 (01:04 -0400)]
Misc test coverage improvements

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

13 years agoNeed to check for prlimit
Matthias Clasen [Wed, 5 Oct 2011 05:04:02 +0000 (01:04 -0400)]
Need to check for prlimit

13 years agoAdd a test for thread creation failure
Matthias Clasen [Wed, 5 Oct 2011 04:28:53 +0000 (00:28 -0400)]
Add a test for thread creation failure

13 years agogthread.h: a bunch of pointless whitespace changes
Ryan Lortie [Wed, 5 Oct 2011 00:31:33 +0000 (20:31 -0400)]
gthread.h: a bunch of pointless whitespace changes

Make it look pretty.

13 years agoMove typedef GStaticPrivate to deprecated/
Ryan Lortie [Wed, 5 Oct 2011 00:23:20 +0000 (20:23 -0400)]
Move typedef GStaticPrivate to deprecated/

This was missed in the earlier move.

13 years agoDeprecate g_{mutex,cond}_{new,free}()
Ryan Lortie [Tue, 4 Oct 2011 23:09:43 +0000 (19:09 -0400)]
Deprecate g_{mutex,cond}_{new,free}()

Now that we have _init() and _clear(), these old calls are no longer
useful.

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

13 years agogdbusprivate: fix a missed g_mutex_free()
Ryan Lortie [Wed, 5 Oct 2011 00:07:31 +0000 (20:07 -0400)]
gdbusprivate: fix a missed g_mutex_free()

This should have been changed to g_mutex_clear()

13 years agoRemove g_mutex_new()/g_cond_new() in testcases
Ryan Lortie [Tue, 4 Oct 2011 23:04:41 +0000 (19:04 -0400)]
Remove g_mutex_new()/g_cond_new() in testcases

These were the last users of the dynamic allocation API.

Keep the uses in glib/tests/mutex.c since this is actually meant to test
the API (which has to continue working, even if it is deprecated).

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

13 years agodrop errorcheck mutex test
Ryan Lortie [Tue, 4 Oct 2011 22:52:55 +0000 (18:52 -0400)]
drop errorcheck mutex test

We don't support errorchecking mutexes in GLib anymore.

13 years agoGVariant: add a clarification to the docs
Ryan Lortie [Tue, 4 Oct 2011 21:27:27 +0000 (17:27 -0400)]
GVariant: add a clarification to the docs

Add a note to the doc for g_viarnat_get_child_value() that the return
value is non-floating and must be freed with g_variant_unref().

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

13 years agogtimer: remove warnings about threads
Ryan Lortie [Tue, 4 Oct 2011 21:17:01 +0000 (17:17 -0400)]
gtimer: remove warnings about threads

GTimer no longer uses the thread system for time information and
g_thread_init() no longer does anything, so remove the doubly-untrue
warning about these topics.

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

13 years agoend the glib-ctor experiment
Ryan Lortie [Tue, 4 Oct 2011 20:52:03 +0000 (16:52 -0400)]
end the glib-ctor experiment

This was a bad approach.  We attempt to handle initailisation in a more
centralised way now.

13 years agoTest that g_slice_set_config() works
Ryan Lortie [Tue, 4 Oct 2011 20:36:53 +0000 (16:36 -0400)]
Test that g_slice_set_config() works

For a while it didn't work, due to the ctor-based initialisation of
gslice.

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

13 years agogslice: stop using ctors
Ryan Lortie [Tue, 4 Oct 2011 20:38:28 +0000 (16:38 -0400)]
gslice: stop using ctors

We can't initialise gslice from a ctor because g_slice_set_config() must
be called before gslice initialisation.

Instead, do the initialisation in a threadsafe way from the
initialisation function for the thread private data.  This will only be
called once per thread so the synchronisation doesn't pose a significant
overhead here.

Ensure that we try to grab the thread private data directly on entrance
to g_slice_alloc() so that we force the initialisation to occur.
Grabbing the private data is the common case anyway.

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

13 years agowin32: stop leaking GPrivate data
Ryan Lortie [Tue, 4 Oct 2011 20:08:27 +0000 (16:08 -0400)]
win32: stop leaking GPrivate data

Instead of running the GPrivate destructors from our thread proxy code,
run it from the DllMain handler for the DLL_THREAD_DETACH case.

This should ensure that thread-local data is free at the exit of all
threads -- not just the ones we created for ourselves.

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

13 years agoAdd GPrivate destroy notify testcase
Ryan Lortie [Tue, 4 Oct 2011 20:02:16 +0000 (16:02 -0400)]
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

13 years agowin32 fixes from g_thread_init() deprecation
Ryan Lortie [Tue, 4 Oct 2011 19:44:48 +0000 (15:44 -0400)]
win32 fixes from g_thread_init() deprecation

I can't even begin to imagine how these fell through the cracks...

13 years agogitignore
Ryan Lortie [Tue, 4 Oct 2011 19:34:15 +0000 (15:34 -0400)]
gitignore

13 years agoDeprecate g_thread_init()
Ryan Lortie [Tue, 4 Oct 2011 19:30:39 +0000 (15:30 -0400)]
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

13 years agoClean up process of calling g_debug_init()
Ryan Lortie [Thu, 22 Sep 2011 01:20:07 +0000 (21:20 -0400)]
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

13 years agoAdd _g_io_module_get_default(), use to simplify other *_get_default()s
Dan Winship [Tue, 21 Jun 2011 22:21:27 +0000 (18:21 -0400)]
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

13 years agogsettingsbackend: remove useless check
Dan Winship [Thu, 22 Sep 2011 15:52:53 +0000 (11:52 -0400)]
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

13 years agogio/tests/socket-client: fix a crash (and some indentation)
Dan Winship [Tue, 4 Oct 2011 17:19:21 +0000 (13:19 -0400)]
gio/tests/socket-client: fix a crash (and some indentation)

13 years agoBug 660851: Update GIO for changes in GThread API
Chun-wei Fan [Tue, 4 Oct 2011 15:52:38 +0000 (23:52 +0800)]
Bug 660851: Update GIO for changes in GThread API

gsocket.c: Use intern string instead of GStaticPrivate/
           g_static_private_set, as Dan suggested.

13 years ago[gio] Improve doc for g_file_make_directory_with_parents()
Bastien Nocera [Mon, 3 Oct 2011 14:27:15 +0000 (15:27 +0100)]
[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

13 years agoFix an invalid non-looping use of GCond
Ryan Lortie [Tue, 4 Oct 2011 15:07:15 +0000 (11:07 -0400)]
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

13 years agoGIO: switch a couple more GMutex users to _init()
Ryan Lortie [Tue, 4 Oct 2011 03:44:37 +0000 (23:44 -0400)]
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

13 years agoMake G_ASSERT_STATIC work with clang
Ryan Lortie [Tue, 4 Oct 2011 15:52:47 +0000 (11:52 -0400)]
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

13 years agoGDBus codegen: generate code with embedded GMutex
Ryan Lortie [Tue, 4 Oct 2011 04:09:53 +0000 (00:09 -0400)]
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

13 years agoGThreadedResolver: port to embedded GMutex/GCond
Ryan Lortie [Tue, 4 Oct 2011 04:02:36 +0000 (00:02 -0400)]
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

13 years agoGMain, ThreadPool: embed GCond in struct
Ryan Lortie [Tue, 4 Oct 2011 03:52:13 +0000 (23:52 -0400)]
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

13 years agoGCancellable: use GCond and GMutex directly
Ryan Lortie [Tue, 4 Oct 2011 03:33:57 +0000 (23:33 -0400)]
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

13 years agoGDBus: switch to struct-embedded GMutex and GCond
Ryan Lortie [Tue, 4 Oct 2011 03:26:55 +0000 (23:26 -0400)]
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

13 years agogstringchunk.c: Include gutils.h
Chun-wei Fan [Tue, 4 Oct 2011 05:56:30 +0000 (13:56 +0800)]
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.

13 years agoAdd README notes about recent changes
Ryan Lortie [Tue, 4 Oct 2011 14:59:29 +0000 (10:59 -0400)]
Add README notes about recent changes

13 years agomacro wrappers for g_once_init_enter/leave
Ryan Lortie [Mon, 3 Oct 2011 18:40:00 +0000 (14:40 -0400)]
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

13 years agoFix DATADIRNAME on OpenBSD.
Antoine Jacoutot [Tue, 4 Oct 2011 05:52:10 +0000 (07:52 +0200)]
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".

13 years agorec-mutex testcase: add a performance test
Ryan Lortie [Sun, 2 Oct 2011 16:08:56 +0000 (12:08 -0400)]
rec-mutex testcase: add a performance test

Add a reasonable performance test for uncontended and contended cases at
different levels of recursion depth.

13 years agoIn the GVariant intro, mention lack of built-in endianness, and rationale
Simon McVittie [Mon, 3 Oct 2011 13:27:15 +0000 (14:27 +0100)]
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>
13 years agog_variant_get_data: mention what you need to know to deserialise
Simon McVittie [Mon, 3 Oct 2011 13:20:51 +0000 (14:20 +0100)]
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>
13 years agog_variant_new_from_data: mention that the caller might need to byteswap
Simon McVittie [Mon, 3 Oct 2011 13:19:58 +0000 (14:19 +0100)]
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>
13 years agoFix a typo in describing GVariant serialisation functions
Simon McVittie [Tue, 4 Oct 2011 11:39:08 +0000 (12:39 +0100)]
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>
13 years agoEscape percent sign in g_variant_new_parsed documentation
Simon McVittie [Tue, 4 Oct 2011 09:46:13 +0000 (10:46 +0100)]
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>
13 years agog_variant_get_fixed_array: document which types are appropriate
Simon McVittie [Wed, 13 Oct 2010 11:22:41 +0000 (12:22 +0100)]
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>
13 years agoGVariant docs: be clear that the serialisation format isn't the same as D-Bus
Simon McVittie [Wed, 13 Oct 2010 11:21:22 +0000 (12:21 +0100)]
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>
13 years agoBe clear that g_str_hash etc. don't accept NULL
Simon McVittie [Tue, 4 Oct 2011 08:48:35 +0000 (09:48 +0100)]
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>
13 years agoBe completely clear about what g_direct_hash, g_direct_equal do
Simon McVittie [Tue, 4 Oct 2011 08:44:27 +0000 (09:44 +0100)]
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>
13 years agoGHashTable: be more clear what g_int_hash wants
Simon McVittie [Tue, 4 Oct 2011 08:42:28 +0000 (09:42 +0100)]
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>
13 years agoWarn when classes/instances exceed the allowed size, if possible
Simon McVittie [Mon, 3 Oct 2011 17:48:15 +0000 (18:48 +0100)]
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>
13 years agoUpdate glibconfig.h.win32(.in)
Chun-wei Fan [Tue, 4 Oct 2011 06:06:10 +0000 (14:06 +0800)]
Update glibconfig.h.win32(.in)

Update typedef of GStaticMutex here to match the typedef of GMutex
in glib/gthread.h (due to commit c5634df6)

13 years agoImprove test coverage in the thread tests
Matthias Clasen [Tue, 4 Oct 2011 04:46:10 +0000 (00:46 -0400)]
Improve test coverage in the thread tests

Use g_thread_new_full() in some places.