Commit Graph

10052 Commits

Author SHA1 Message Date
Benjamin Otte
d9440687ff gobject: Speed up g_type_from_name()
The hash table used exclusively for looking up types by name used to map
quarks => types. But we can easily make it map strings => types, which
avoids the quark lookup. And that in trun avoids taking a lock and
consulting another hash table. So this change should make
g_type_from_name() roughly twice as fast.
2011-05-17 15:01:36 +02:00
John Lindgren
aeac5de2f8 keyfile: fill parse buffer in line sized chunks
When loading a keyfile the incoming bytes are fed
to a line buffer to get parsed each time a new line
is encountered.

The code that fills the line buffer does it inefficiently,
one byte at a time.

This commit changes that code to look ahead at the incoming
bytes for the next '\n' character and then fill the line buffer
all at once.

https://bugzilla.gnome.org/show_bug.cgi?id=650211
2011-05-16 23:41:55 -04:00
John Lindgren
9c1a44cf32 keyfile: avoid needless allocations on file load
When loading a key file, the keys and values of individual lines
are allocated once when copied and trimmed from the parse buffer
and allocated/copied again when added to the lookup map.

This commit avoids the second pair of allocations by introducing
a new function g_key_file_add_key_value_pair that gives the
lookup map direct ownership of the key and value copied from the
parse buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=650211
2011-05-16 23:36:39 -04:00
Matthias Clasen
f96dc555d5 Rename a problematic test binary
Having a binary called printf is apparently asking for trouble,
so lets not do that.

http://bugzilla.gnome.org/show_bug.cgi?id=650078
2011-05-16 14:39:53 -04:00
Emmanuele Bassi
b5934de456 Add gdbus autogenerated xml files to the ignore file 2011-05-16 16:10:06 +01:00
Javier Jardón
014b4b5ae9 m4macros/gsettings.m4: Use AS_HELP_STRING instead the deprecated AC_HELP_STRING 2011-05-16 12:51:59 +01:00
Javier Jardón
d2d3449a8e autogen.sh: Use autoreconf instead custom script 2011-05-16 12:03:24 +01:00
David Zeuthen
11e01802ab gdbus-codegen: Ensure that generated skeletons are MT-safe
For example, if setting a property on a skeleton from another thread
than where it was constructed, the idle handler responsible for
emitting the PropertiesChanged() signal could run immediately and
clear skeleton->priv->changed_properties_idle_source causing
g_source_unref() to be called with a NULL pointer. This race was
easily be fixed by adding a lock to the skeleton object.

In addition to fixing this race, also move the code for setting up the
idle handler to a class handler for the GObject::notify signal. This
change allows use of g_object_freeze_notify() and g_object_thaw_notify()
to perform atomic property changes from another thread than the one
that the skeleton was created in.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-15 12:38:24 -04:00
Philip Withnall
2122191595 docs: Improve punctuation in some of the GArray method documentation 2011-05-15 15:31:16 +01:00
Benjamin Otte
cb7a5a8e94 docs: Add the cute trick comment to all sort functions
Thanks to Sebastian Dröge for pointing out there's more than
g_array_sort() and I hadn't in fact added the comment to g_array_sort()
in 80928ea403
2011-05-15 16:16:30 +02:00
Benjamin Otte
80928ea403 docs: Add a cute trick for achieving a stable sort
This trick is inspired by
http://www.gnu.org/s/hello/manual/libc/Array-Sort-Function.html
http://jeffreystedfast.blogspot.com/2011/04/optimizing-merge-sort.html
2011-05-15 16:13:55 +02:00
Kristjan SCHMIDT
125b896a4e Updated Esperanto translation 2011-05-15 10:16:59 +02:00
David Zeuthen
ae10eca116 gdbus-codegen: Use (skip) annotation on return values
This was discussed in bug 649657.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-13 14:24:22 -04:00
Yaron Shahrabani
4a7a1bc437 Updated Hebrew translation. 2011-05-13 08:38:35 +03:00
David Zeuthen
b9e3e03767 GDBusConnection: Document that sockets are frobbed into non-blocking mode
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-12 15:36:34 -04:00
David Zeuthen
ce77614142 gdbus-codegen: Mark members in generated class instance structs as private
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-11 21:16:41 -04:00
David Zeuthen
5a811135f7 Add g_dbus_method_invocation_take_error() convenience method
Similar in spirit to g_simple_async_result_take_error().

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-11 20:57:54 -04:00
Colin Walters
d39731724a gdbus-codegen: Fix annotation parsing
It takes 3 options.
2011-05-11 17:13:57 -04:00
Maarten Bosmans
97cd6fa2e3 gdbus-codegen: Quote substitution variables
Avoids failure if they contain spaces.

Commit message written by Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=649775
2011-05-11 15:47:00 -04:00
Colin Walters
61295f87c9 gdbus-codegen: Drop dependency on argparse
This is only in Python 2.7 or as a separate module.  Use optparse
which exists since 2.3.

https://bugzilla.gnome.org/show_bug.cgi?id=649988
2011-05-11 15:39:34 -04:00
Giovanni Campagna
eebb3647a1 gbase64: fix introspection annotations
Makes the g_base64_* functions usable from introspection GLib bindings
(gjs, currently, as both vala and pygobject use manual bindings for
GLib)

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-11 20:10:25 +02:00
Colin Walters
c026cf56a1 gdatetime: Quiet GCC warning about possibly-uninitialized 2011-05-11 13:19:05 -04:00
Ryan Lortie
c2a2350cc1 GSettings: fix example in the docs 2011-05-10 15:25:54 +02:00
Giovanni Campagna
53dc341b0d GDBusMethodInvocation: fix introspection annotations
In particular (transfer full), to avoid a refcounting bug and a
segmentation fault.

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-09 19:04:25 +02:00
Martin Pitt
21c2291496 [gi] Add missing allow-none annotations to GDBusConnection 2011-05-08 23:07:40 +02:00
Yuri Kozlov
3495f57d6b Updated Russian translation 2011-05-08 12:05:09 +04:00
Daniel Mustieles
13211c5b60 Updated Spanish translation 2011-05-07 12:38:56 +02:00
Ryan Lortie
1361ec78cd GSettings: keep resets on loss of writability
Don't drop resets from a GDelayedSettingsBackend when the writability
changes.  Resets will always succeed, even against non-writable keys and
some people (gnome-screensaver) are using them in a way that they would
want them not to be forgotten.
2011-05-07 11:45:44 +02:00
Ryan Lortie
a38c97af51 Allow NULL to be stored into GSettings trees
This is used for resets (in theory) and currently it crashes when
freeing the tree.
2011-05-07 11:45:44 +02:00
David Zeuthen
720d6ec8e4 gdbus: Add a --timeout option
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-06 15:27:52 -04:00
Ray Strode
7bcede9301 gdbus-codegen: fix typo in man page
s/on_handle_hello-world/on_handle_hello_world/
2011-05-06 13:00:38 -04:00
David Zeuthen
f773bd8b76 gdbus-codegen: gracefully handle property get on proxy with no cached property
This can easily happen if the owner of the remote object vanishes. Of
course, when that happens, user code is already notified (by e.g. the
notify::g-name-owner signal) so it can avoid using the proxy but
requiring that is a bit harsh. IOW, before this patch this critical
error was printed

 GLib-GIO-CRITICAL **: g_dbus_gvariant_to_gvalue: assertion `value != NULL' failed

when that happened. With this patch, we just avoid setting the GValue
so the user will get the default value for its type instead. So, for
example, if the user code is getting a GVariant property on such a
defunct proxy, then he gets a NULL back. So unless said user code
checks the return value, criticals will still be printed if the NULL
GVariant is used for anything interesting.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-06 10:32:42 -04:00
Matthias Clasen
3d3659c1b6 Documentation additions
Add Since tags to recently introduced test function typedefs.
https://bugzilla.gnome.org/show_bug.cgi?id=649506
2011-05-06 07:14:48 -04:00
Dan Winship
914d10055c Add two annotations for g-i 2011-05-05 15:18:22 -04:00
Matthias Clasen
17d8d2cc44 Add tests for new GDateTime functionality 2011-05-05 14:57:09 -04:00
Matthias Clasen
e15ecab048 Expand the g_date_time_format documentation
Mention strftime, and explain supported modifiers.
2011-05-05 14:57:09 -04:00
Matthias Clasen
d23c33a04b GDateTime: enhance g_date_time_format()
Make g_date_time_format() support some useful format modifiers from
strftime(). This commit adds support for the POSIX 'O' modifier
(alternative digits), as well as the -/_/0 padding modifiers, which
are a GNU strftime() extension.
https://bugzilla.gnome.org/show_bug.cgi?id=648678
2011-05-05 14:57:09 -04:00
Colin Walters
8932a1a7a3 GSocket: Use MSG_CMSG_CLOEXEC
This ensures received file descriptors don't leak to child processes.

https://bugzilla.gnome.org/show_bug.cgi?id=649480
2011-05-05 14:09:11 -04:00
Chun-wei Fan
7ca8691a93 Update VS2010 "install" project
The dependencies on gsettings and glib-compile-schemas were missed-made
up for them here.
2011-05-05 15:09:51 +08:00
Chun-wei Fan
9f90408e97 Update gcancellable.c for Win32
errno.h is still required for Windows in this file...
2011-05-05 13:40:38 +08:00
Chun-wei Fan
8f484c482d Update VS property sheets
There are some new public headers added for GIO.  Make up for them here
in the install phase
2011-05-05 13:36:34 +08:00
Chun-wei Fan
58c5973a00 MSVC support update for GObject
Apparently GObject now depends on libffi.  Add it to the dependencies list.

For MSVC, use the libffi-3.0.10(rcx) versions.
2011-05-05 12:42:44 +08:00
Chun-wei Fan
5b5299e1c4 GLib MSVC Support updates (autotools)
Filter out *-unix.c from the source file list, as it is obviously not
usable (nor used) under VS 2008/2010
2011-05-05 12:35:45 +08:00
Matthias Clasen
6c4b84d5ff Post-release bump 2011-05-04 21:26:11 -04:00
Matthias Clasen
5b4da74bc7 More distcheck fixes 2011-05-04 20:45:46 -04:00
Matthias Clasen
d5d4659a60 Try to fix distcheck 2011-05-04 19:44:05 -04:00
Matthias Clasen
6ea2291573 Pre-release bump 2011-05-04 14:53:08 -04:00
Matthias Clasen
5b45c39b4b Updates 2011-05-04 14:33:03 -04:00
Ray Strode
c062350159 gdbus-codegen: don't assert non-negativity for unsigned values
The code generator sprinkles a few asserts in its output of the form:

g_assert (prop_id - 1 >= 0 && prop_id - 1 < %d);\n

prop_id is unsigned, though, so this generates a compiler warning for
me.

This commit changes the code to merely check for prop_id != 0 instead of
prop_id - 1 >= 0
2011-05-04 12:45:22 -04:00
Ryan Lortie
e823ba10d3 GVariant: Better handling of invalid UTF-8
g_variant_new_string() hits a g_return_if_fail() when given invalid
UTF-8.  That's certainly the right thing to do, but
g_variant_builder_add() uses this function internally and crashes when
it returns NULL due to the user passing a non-utf8 string.

We can protect the internal code by returning "[Invalid UTF-8]" in this
case while also making the problem easier to debug (and less fatal).

Closes #632631.
2011-05-04 18:20:23 +02:00