Commit Graph

10973 Commits

Author SHA1 Message Date
Chun-wei Fan
d77f65d24d Revert "gobject/gclosure.c: Made up for missed pointer deref"
This reverts commit d792a1ebe4.
2011-10-06 15:33:34 +08:00
Chun-wei Fan
d792a1ebe4 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.
2011-10-06 15:24:08 +08:00
Chun-wei Fan
ed03047a5b gthread-deprecated.c: Include gutils.h
This is needed for declaration of inline.
2011-10-06 15:12:22 +08:00
Chun-wei Fan
eb17516a67 config.h.win32(.in): Update for strcasecmp
Visual C++ uses _stricmp, which is identical to strcasecmp on gcc.
2011-10-06 15:03:30 +08:00
Matthias Clasen
3636cf2c64 Update threads docs for the demise of g_thread_init() 2011-10-05 22:43:22 -04:00
Matthias Clasen
47c7fa2ccd Remove mention of gthread-2.0.pc from 'Compiling' section
At the same time, add one or two other corrections.
2011-10-05 22:31:17 -04:00
Matthias Clasen
749758ec78 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.
2011-10-05 22:23:25 -04:00
Dan Williams
8e82225aed 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
2011-10-05 14:08:22 -05:00
Colin Walters
c3133affcd 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
2011-10-05 13:39:30 -04:00
Ryan Lortie
9560423a6e Be sure to #include "gutils.h" in gbacktrace.c
0e3f530185 introduced a compiler warning
about implicit declaration of g_get_prgname().  Fix that.

Problem caught and fix suggested by Rico Tzschichholz.
2011-10-05 13:17:07 -04:00
David Zeuthen
f34908ef15 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>
2011-10-05 12:42:06 -04:00
Dan Winship
7ca83c6c9f Fix up some doc comments that referred to threads not being enabled
(and a few other unrelated comment fixes)
2011-10-05 11:54:36 -04:00
David Zeuthen
af55ff5a2b GDBus: disable two more GDBus tests using fork()
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-05 10:56:11 -04:00
David Zeuthen
2b963266b6 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>
2011-10-05 10:45:22 -04:00
Dan Winship
2f48b4b7fb 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.
2011-10-05 08:36:03 -04:00
Matthias Clasen
0e3f530185 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
2011-10-05 01:12:53 -04:00
Matthias Clasen
5fef796126 Misc test coverage improvements
https://bugzilla.gnome.org/show_bug.cgi?id=660849
2011-10-05 01:12:52 -04:00
Matthias Clasen
ddbd4acdfb Need to check for prlimit 2011-10-05 01:04:02 -04:00
Matthias Clasen
ea4bc6008f Add a test for thread creation failure 2011-10-05 00:28:53 -04:00
Ryan Lortie
08a6d81231 gthread.h: a bunch of pointless whitespace changes
Make it look pretty.
2011-10-04 20:33:58 -04:00
Ryan Lortie
674543d091 Move typedef GStaticPrivate to deprecated/
This was missed in the earlier move.
2011-10-04 20:33:58 -04:00
Ryan Lortie
69c0b4440e 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
2011-10-04 20:08:14 -04:00
Ryan Lortie
26a6b3c6ff gdbusprivate: fix a missed g_mutex_free()
This should have been changed to g_mutex_clear()
2011-10-04 20:08:14 -04:00
Ryan Lortie
6f343ca548 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
2011-10-04 19:35:27 -04:00
Ryan Lortie
9793708931 drop errorcheck mutex test
We don't support errorchecking mutexes in GLib anymore.
2011-10-04 18:52:55 -04:00
Ryan Lortie
4d5fe27048 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
2011-10-04 17:32:53 -04:00
Ryan Lortie
6b566e1d0b 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
2011-10-04 17:32:53 -04:00
Ryan Lortie
e3be556728 end the glib-ctor experiment
This was a bad approach.  We attempt to handle initailisation in a more
centralised way now.
2011-10-04 17:32:53 -04:00
Ryan Lortie
bb5d90a768 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
2011-10-04 17:32:53 -04:00
Ryan Lortie
5bfb64d507 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
2011-10-04 17:32:41 -04:00
Ryan Lortie
f1512917e6 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
2011-10-04 16:08:27 -04:00
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