Commit Graph

3219 Commits

Author SHA1 Message Date
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
Matthias Clasen
3e93fa7a25 Improve test coverage of glib-unix.c 2011-06-06 00:31:06 -04:00
Matthias Clasen
bb0cbc2ae1 Improve test coverage of gurifuncs.c 2011-06-06 00:30:50 -04:00
Matthias Clasen
059fa31ad1 Improve test coverage
Duplicate the atomic tests for the functions, and
test the new atomic operations as well.
2011-06-06 00:28:38 -04:00
Matthias Clasen
a79a5a6202 No need to have two variants of errno-to-GError 2011-06-05 22:20:18 -04:00
Matthias Clasen
594bf7460a Fix parameter documentation for many functions
Use the opt-out mechanism introduced in gtk-doc 1.16 to work
around problems with the _utf8 renaming games that the win32
port is playing in our headers.

https://bugzilla.gnome.org/show_bug.cgi?id=638449
2011-06-04 14:43:52 -04:00
Matthias Clasen
75f7eef9cd Fix doc typos
Now with fewer broken links...
2011-06-04 14:43:52 -04:00
Paolo Bonzini
c5d9a46394 avoid quadratic behavior of GMainLoop when all fd's have the same priority
https://bugzilla.gnome.org/show_bug.cgi?id=640518
2011-06-04 00:00:24 -04:00
Matthias Clasen
1e88c5321c Add a test for the previous fix 2011-06-03 23:38:46 -04:00
Matthias Clasen
77be95cdce GRand: avoid overflow
Otherwise, g_random_double_range (-G_MAXDOUBLE, G_MAXDOUBLE)
doesn't work as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=502560
2011-06-03 23:37:23 -04:00
Matthias Clasen
deed4dd36b g_mkdir_with_parents: cope with dirs popping into existence
Don't bail out if a directory suddenly turns out to exist
after all. Proposed in bug 612729.
2011-06-03 22:45:51 -04:00
Mikhail Zabaluev
69efeee287 Made g_utf8_to_ucs4_fast() even faster
https://bugzilla.gnome.org/show_bug.cgi?id=619435
2011-06-03 22:31:39 -04:00
Mikhail Zabaluev
1b101a3873 Added performance tests for UTF-8 decoding functions
https://bugzilla.gnome.org/show_bug.cgi?id=619418
2011-06-03 22:28:34 -04:00
Matthew Barnes
f065d7d60e Have g_queue_remove() return a boolean
g_queue_remove() should return a boolean so callers can verify that an
element was found and removed, as in the following example:

    if (g_queue_remove (queue, referenced_object))
        g_object_unref (referenced_object);

Similarly, g_queue_remove_all() should return the number of elements
found and removed.

https://bugzilla.gnome.org/show_bug.cgi?id=632294
2011-06-03 22:04:31 -04:00
Wim Taymans
496157ffd3 gthread: avoid locking in _get_mutex_impl
When getting the mutex implementation of a static mutex, avoid taking the global
lock every time but only take the lock when there was no mutex and we need to
create one.

https://bugzilla.gnome.org/show_bug.cgi?id=599954
2011-06-03 21:42:51 -04:00
Alexander Larsson
fca330dafa Use g_atomic_pointer_or/and to set datalist flags
https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:26 -04:00
Alexander Larsson
1cceda49b6 Make g_datalist_get_data not look up the quark
Instead of converting the string to a quark and comparing quarks we
use the new lockless g_quark_to_string and just compare the quarks
in the datalist with the given string.

This means we avoid the global lock for string to quark. Additionally
most of the time the data list will be quite short, so the cost of
doing the sting comparisons is likely similar to that of the quark
hashtable lookup (which does at least one string comparison for a
successfull lookup).

https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:26 -04:00
Alexander Larsson
7ae5e9c248 Make quark to string lockless
We do this by assigning to g_quarks atomically and leaking it when
replacing it atomically. Then its safe to consume the array
on the reader side (atomically).

Also, since we're leaking quarks on growing, bump the block size
so that we're not leaking as much. gtk3-demo allocates > 1500 quarks,
and gnome apps > 3000. I'm setting the block to 2048 which means no
leaks for small gtk3 apps and just one leak for gnome apps.

https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:26 -04:00
Alexander Larsson
3f8638ce93 Make g_datalist not use a global lock and perform better
This implementation uses a per-list bitlock for user data, and a
simple array rather than a linked list which uses less memory and less
allocations. It also gets better cache behaviour since related things
are stored close to each other.

https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:19 -04:00
Ryan Lortie
df0b208831 Implement pointer sized bitlocks
Based on a patch from Alexander Larsson.

https://bugzilla.gnome.org/show_bug.cgi?id=651467
2011-06-03 20:50:18 -04:00
Ryan Lortie
1a80405a36 bitlock: hand-code assembly version for x86
The __sync_fetch_and_or() operation on x86 is a bit suboptimal when the
result isn't ignored.  Normally we could use the 'lock or' assembly
instruction to accomplish this, but this instruction discards the
previous value.

In order to work around this issue, GCC is forced to emit a
compare-and-exchange loop.

We can easily use the 'lock bts' instruction, though.  It can't be used
in the general case for __sync_fetch_and_or() but it works great for our
case (test and set a single bit).

I filed a bug against GCC[1] to get this exposed as a new intrinsic (or
have the optimiser detect the case) but until then we'll hand-code it on
x86 and amd64.

The uncontended case sees a 31% improvement on my test machine.

 [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49244

https://bugzilla.gnome.org/show_bug.cgi?id=651467
2011-06-03 17:33:39 -04:00
Giovanni Campagna
f2bd54d0c5 gvariant: fix introspection annotations
g_variant_get_strv and g_variant_get_bytestring return arrays that
are null terminated and have an explicit length. Since gjs doesn't
support (out) arrays with length, mark them also null-terminated
(but leave the length annotation, so pygobject can remove the argument)

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-06-03 16:39:43 -04:00
Colin Walters
c34a6a66e7 gmain: Consolidate UNIX signal init state handling
For a future signalfd() patch, it will be easier to handle if
we don't separate initialization from watching for a particular
signal.

https://bugzilla.gnome.org/show_bug.cgi?id=651725
2011-06-03 11:38:18 -04:00
Colin Walters
6ea274bca4 gmain: Clean up SIGCHLD handling
Unify it more with the rest of the signal handling code.  There's
no reason not to specify SA_RESTART and SA_NOCLDSTOP for flags
always, so just do it.

Remove unnecessary initialization, and push the internal API
towards just ensure_unix_signal_handler_installed_unlocked().

https://bugzilla.gnome.org/show_bug.cgi?id=651725
2011-06-03 11:38:18 -04:00