Commit Graph

3242 Commits

Author SHA1 Message Date
Colin Walters
1b0e5e7683 gmain: Fall back to pipes if kernel doesn't support EFD_CLOEXEC for eventfd()
Also remove the caching of checking for eventfd; just try it every time, it's
cheap enough to do so.

https://bugzilla.gnome.org/show_bug.cgi?id=653570
2011-06-28 10:03:15 -04:00
Matthias Clasen
9eb65dd3ed Unicode: add a g_utf8_substring convenience api
This function is useful in the GTK+ accessibility implementations,
and seems like a nice thing to have around in general.
2011-06-23 21:31:40 -04:00
Christian Persch
c2b112bc56 Typo fix 2011-06-24 01:07:18 +02:00
Christian Persch
b1b8c95d35 Plug a mem leak in the regex test 2011-06-24 01:03:52 +02:00
Christian Persch
00afe3fed3 Make GMatchInfo refcounted 2011-06-24 01:03:46 +02:00
Colin Walters
3904c8761a gmain: use Linux eventfd() for main context wake up
The Linux eventfd() call is basically tailor made for the main loop
wake up pipe - all we want is a threadsafe way to write to a file
descriptor, and wake up the context on the other end; we don't care
about the content at all.

The eventfd manual page basically explains the benefits:

       Applications can use an eventfd file descriptor instead of a
       pipe (see pipe(2)) in all cases where a pipe is used simply to
       signal events.  The kernel overhead of an eventfd file
       descriptor is much lower than that of a pipe, and only one file
       descriptor is required (versus the two required for a pipe).

When writing my multithreaded spawn test case I actually hit the 1024
file descriptor limit quickly, because we used 2 fds per main context.
This brings that down to 1.

https://bugzilla.gnome.org/show_bug.cgi?id=653140
2011-06-21 23:28:52 -04:00
Philip Van Hoof
f6ed357101 Add iter_replace API to GHashTableIter
https://bugzilla.gnome.org/show_bug.cgi?id=652822
2011-06-20 23:05:59 -04:00
Christian Persch
f9cec26968 Clarify nul-termination of g_utf8_to_ucs4[_fast] result
The docs for g_utf8_to_ucs4_fast didn't mention that the resulting
string is terminated by a 0 character.

Bug #652897.
2011-06-19 13:14:39 +02:00
Matthias Clasen
580e177dcc Add tests for GCache 2011-06-19 01:42:48 -04:00
Matthias Clasen
63fa44251a utils: silence tests unless verbose 2011-06-19 01:05:05 -04:00
Matthias Clasen
e1d4e06ab3 logging: improve test coverage 2011-06-19 01:04:48 -04:00
Matthias Clasen
ed3ac87afe hash: Improve test coverage 2011-06-19 01:04:30 -04:00
Colin Walters
4476e22a14 gvariant: Mark g_variant_new_variant as constructor
https://bugzilla.gnome.org/show_bug.cgi?id=647796
2011-06-17 09:39:48 -04:00
Murray Cumming
34b7126a4e G_STATIC_REC_MUTEX_INIT: Add a 0 to the initialization.
This avoids a compiler warning about an incomplete initialization
when using this.
2011-06-15 10:47:13 +02:00
Ryan Lortie
23f684454f Drop dead code in GVariant parser
There is no chance that an unsigned integer value will be negative after
we do the bounds check that enforces its non-negativity.

Caught by Matthias running Coverity.
2011-06-14 22:45:06 -04:00
Matthias Clasen
a6b9db6907 Eliminate some dead code 2011-06-14 21:06:17 -04:00
Matthias Clasen
f966a0af9a Add some argument checks to filename conversion functions 2011-06-14 21:06:16 -04:00
Colin Walters
c9f883f133 gmain: Close race condition in _g_main_wake_up_all_contexts()
Running gthread/tests/spawn-multithreaded in a loop, I very easily hit:

GLib-CRITICAL **: g_main_context_wakeup: assertion `g_atomic_int_get (&context->ref_count) > 0' failed

Testing the refcount still left a window where we would fall into the
assertion.  Fix this by just locking the context.
2011-06-14 19:23:36 -04:00
Colin Walters
211d7adf6e gmain: Only run through signal delivery once per read()
This is what I intended to do before.

https://bugzilla.gnome.org/show_bug.cgi?id=652072
2011-06-14 19:23:36 -04:00
Colin Walters
ed827deb77 gmain: Use sigset_t for keeping track of installed signals
Minor code cleanup.

https://bugzilla.gnome.org/show_bug.cgi?id=652072
2011-06-14 19:23:36 -04:00
Colin Walters
1874ad97d8 gspawn: Reset signal handlers for synchronous spawning
We should by default reset signal handlers; particularly with the
ability to install them via g_unix_signal_source_new(), we don't
want to call a user callback inside a fork()ed helper process.

https://bugzilla.gnome.org/show_bug.cgi?id=652072
2011-06-14 19:23:36 -04:00
Colin Walters
b9c67b4369 glib/tests/unix.c: Also test SIGTERM
We expect this to not kill the process, so it'd be a good one to test.

https://bugzilla.gnome.org/show_bug.cgi?id=652072
2011-06-14 19:23:36 -04:00
Colin Walters
7e1886ba72 gspawn: Handle EINTR in a few more cases
I was debugging gthread/tests/spawn-multithreaded.c, and while I
don't think I actually hit EINTR in any of these cases, it'd be
good to fix them anyways.

https://bugzilla.gnome.org/show_bug.cgi?id=652072
2011-06-14 19:23:35 -04:00
Matthias Clasen
25a797fa25 Silence a compiler warning
Even though we are confident the filename will always
end in .gmarkup, the compiler doesn't know that...
2011-06-14 10:16:35 -04:00
Matthias Clasen
6ac8e6108c Don't leak resources in error cases 2011-06-14 10:12:46 -04:00
Matthias Clasen
4dc3d3e999 Use a realistic timeout in a test
Who knew that g_test_trap_fork() takes a timeout in microseconds...
2011-06-13 22:50:02 -04:00
Ryan Lortie
fd772fbe95 Formally deprecate G_CONST_RETURN 2011-06-13 09:27:41 -04:00
Dan Winship
7412e073d1 update .gitignores 2011-06-12 16:17:30 -04:00
Colin Walters
9d53e2bc4e gspawn: Fix annotations
g-ir-scanner wants guint8.
2011-06-10 12:58:49 -04:00
Ryan Lortie
8073759f8c Remove all uses of G_CONST_RETURN
Just use 'const'.

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-06-09 11:15:40 -04:00
Matthias Clasen
b04f6dbca0 Move gmain docs inline 2011-06-08 23:48:55 -04:00
Matthias Clasen
7648415a50 Move gutils docs inline 2011-06-08 23:44:39 -04:00
Christophe Fergeau
602f8baa0b bitlock: don't use asm goto on older gcc
asm goto was addded in gcc 4.5 so don't try to use it on gcc versions
older than this one. This is achieved by explicitly checking gcc
version, an alternative would be to try to compile a program using
asm volatile in configure.

https://bugzilla.gnome.org/show_bug.cgi?id=651959
2011-06-08 22:39:35 -04:00
Giovanni Campagna
37c9775b82 gutils, gspawn: fix introspection annotations
Fix various (out) arguments, (allow-none) and (array zero-terminated=1)
for g_spawn_*() and some others.

Some additional fixes by Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-06-07 17:13:15 -04:00
Colin Walters
f0620902b2 Update annotations from gobject-introspection/gir/glib-2.0.c
This covers most of them.
2011-06-07 17:07:46 -04:00
Colin Walters
ab0e9dbfa7 Generate $module-public-headers.txt file, feed it to gtk-doc
Rather than having the gtk-doc build machinery have a list of header
files to exclude, change the GLib build to dump a list of public
header files generated from the maintained Makefile.am files for
each of glib/, gobject/, gio/.

Also, for glib, always install glib-unix.h, even on non-Unix
platforms, for the same reason we install gwin32.h even on Unix.

https://bugzilla.gnome.org/show_bug.cgi?id=651745
2011-06-07 14:18:36 -04:00
Colin Walters
de57755dbc g_get_user_data_dir(): Don't warn if XDG_RUNTIME_DIR isn't set
We have a meaningful fallback, and warning causes the tests to break.
2011-06-07 13:02:41 -04:00
Matthias Clasen
d4be2925e4 Add a testcase for the previous fix 2011-06-06 23:25:42 -04:00
Matthias Clasen
c917202552 GDataList: don't hold the bitlock over callbacks
g_datalist_id_clear_i was dropping the dataset lock around
the destroy notifies, but kept the bitlock. This was causing
deadlocks when finalizing widgets.
2011-06-06 23:25:42 -04:00
Chun-wei Fan
405b4ff4f4 Update the year in the *.rc.in files
Sorry this change came a bit late...
2011-06-07 08:55:31 +08:00
Chun-wei Fan
fba436f2cb Fix gatomic.c compilation on Windows (MSVC)
-windows.h must be included for the functions[1] to be found during
 compilation
-For Win32(x86), the InterlockedAnd, InterlockedOr and InterlockedXor
 functions need to be preceded with an underscore. This is mandated
 by the "For the x86 architecture..." clause under "Remarks"[2]
-This will close Bug 652000

[1]:http://msdn.microsoft.com/en-us/library/ms684122(v=vs.85).aspx
[2]:http://msdn.microsoft.com/en-us/library/ms683516(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/library/ms683626(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/library/ms684021(v=vs.85).aspx
2011-06-07 08:20:15 +08:00
Colin Walters
a6f09e104c GBuffer: Suffix header with private.h
This makes it clearer it's not public API yet.

https://bugzilla.gnome.org/show_bug.cgi?id=651745
2011-06-06 09:58:21 -04:00
Matthias Clasen
782cf86f12 GMappedFile: improve test coverage 2011-06-06 01:14:23 -04:00
Matthias Clasen
698bb5d962 GKeyFile: improve test coverage 2011-06-06 01:14:00 -04:00
Matthias Clasen
7cf16c3094 GConvert: improve test coverage 2011-06-06 01:13:46 -04:00
Matthias Clasen
e02d8165d9 Improve GChecksum test coverage 2011-06-06 01:13:26 -04:00
Matthias Clasen
4971c43da8 GMappedFile: remove nonatomic accesses to ref_count 2011-06-06 01:04:19 -04:00
Matthias Clasen
ae96118395 Improve test coverage of gtimezone.c 2011-06-06 00:31:52 -04:00
Matthias Clasen
f0b14653f8 Improve test coverage of GVariant 2011-06-06 00:31:40 -04:00
Matthias Clasen
70c082127f Improve test coverage of glist.c 2011-06-06 00:31:24 -04:00