Commit Graph

3242 Commits

Author SHA1 Message Date
Simon McVittie
b05f0b351c g_static_private_free: defer non-trivial destruction til after we unlock
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=642026
Bug-NB: NB#257512
2011-05-28 10:00:40 -04:00
Simon McVittie
d5f0ec1e8e GRealThread: remove obsolete comment about gmain.c, which no longer has a copy
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=642026
Bug-NB: NB#257512
2011-05-28 10:00:39 -04:00
Matthias Clasen
00734ef99f Add macro version for all atomic operations
Better to be consistent about this.
2011-05-28 00:16:39 -04:00
Matthias Clasen
7cf1122253 Use G_STATIC_ASSERT_EXPR for size checks in atomic macros
Also add the same size checks to the macros wrapping
gcc builtins.
2011-05-28 00:04:10 -04:00
Ryan Lortie
edd65baa6d Add a test case for atomic ops
Make sure that the macros work properly with the range of types that
they are documented to work with and ensure that no strict aliasing
warnings are issued (even at the highest warning level).

https://bugzilla.gnome.org/show_bug.cgi?id=650935
2011-05-27 23:00:14 -04:00
Ryan Lortie
c00ef0a17a Add G_STATIC_ASSERT_EXPR macro
https://bugzilla.gnome.org/show_bug.cgi?id=626549
2011-05-27 22:36:16 -04:00
Matthias Clasen
64d5a0404a GThread: expand the docs
Mention newer addition to the thread support in the introduction:
bit locks and one-time initialization.
2011-05-27 20:22:20 -04:00
Colin Walters
dfcac7b23e g_variant_new_dict_entry: Fix documentation and annotations
Move @key to not be at the start of a line, otherwise g-ir-scanner
gets confused.

Also two annotation fixes.
2011-05-27 16:12:58 -04:00
Matthias Clasen
5345d21150 forgotten test 2011-05-27 16:09:34 -04:00
Giovanni Campagna
39ba9c8e49 g_variant_get_child_value: Add a precondition on length
Ensure callers get a warning if they pass a bad length.

Split into a separate commit and changed to order index before
n_children by Colin Walters <walters@verbum.org>
2011-05-27 16:05:56 -04:00
Giovanni Campagna
e61fa51fd5 GVariant: fix introspection annotations
Add transfer annotations for most functions, as well as some (array)
and (skip) for functions that use varargs.

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-27 15:56:50 -04:00
Matthias Clasen
5d7b67a6c3 Preserve consistency when removing all nodes from a hash table
During the recent refactorings of GHashTable a bug was introduced
where removing all nodes from a hash table would leave tombstones
behind, but make the counts appear like there are none.

Reported and tracked down by Carlos Garnacho,
https://bugzilla.gnome.org/show_bug.cgi?id=651141

This commit also adds a test that checks the internal consistency
of GHashTable over several insert/remove/remove-all operations.
2011-05-26 21:52:50 -04:00
David Schleef
b92861b5a0 main: Use public function in documentation
https://bugzilla.gnome.org/show_bug.cgi?id=651009
2011-05-26 20:56:51 -04:00
Matthias Clasen
77110304cc Cosmetic changes
Use inc/dec for refcounting.
2011-05-23 00:48:10 -04:00
Matthias Clasen
88f23fb1d9 Cosmetics
Use g_atomic_int_inc/dec instead of add(...,1/-1), since
this is the way refcounting is done elsewhere. Some other
cosmetic changes.
2011-05-23 00:40:33 -04:00
Matthias Clasen
b5056fbaf9 Simply symbols files
The grouping in files/headers is not used anymore, and
the function attributes neither. Adapt abicheck scripts
and .def file generation rules accordingly.
2011-05-23 00:21:06 -04:00
Matthias Clasen
dec7d41275 Improve atomic ops implementation
When using gcc builtins for atomic operations, provide them
as macros, so gcc can see the builtins and do optimizations.
This change gives considerable speedups in bitlocks, which
use atomic operations heavily, see bug 650458.

Also, don't define G_ATOMIC_OP_MEMORY_BARRIER_NEEDED unconditionally
when using gcc builtins.

https://bugzilla.gnome.org/show_bug.cgi?id=617491
2011-05-22 16:31:43 -04:00
Matthias Clasen
f924384634 Trivial: fix a typo 2011-05-21 20:56:04 -04:00
Matthias Clasen
c38b7d769e Revert "g_key_file_has_key_full: Clarify the docs"
This reverts commit 4ddb84999d.
2011-05-21 11:14:05 -04:00
Matthias Clasen
4ddb84999d g_key_file_has_key_full: Clarify the docs 2011-05-21 11:12:08 -04:00
Matthias Clasen
120b85a31b Enforce rules about modifying hash tables in callbacks
We have the infrastructure to do this, so lets do it.
Also add tests for find and foreach to the testsuite.
Bug 650688
2011-05-20 15:07:08 -04:00
Matthias Clasen
afc5319a27 Be more careful when calling destroy notifies
If we are, we can allow modification of the hash table
from destroy notifies.

https://bugzilla.gnome.org/show_bug.cgi?id=650459
2011-05-19 23:51:43 -04:00
Jasper Lievisse Adriaanse
3f3b2bd82b gatomic: #include gthread.h to fix compilation on nonoptimized architectures
The fallback case of implementing atomic integers with mutexes needs
gthread.h.

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

https://bugzilla.gnome.org/show_bug.cgi?id=631153
2011-05-18 12:08:09 -04:00
Colin Walters
9966fe4493 g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics
See https://bugzilla.gnome.org/show_bug.cgi?id=649657 for discussion
of why it's bad for bindings for gerror return values to both signal
errors and carry meaning.

https://bugzilla.gnome.org/show_bug.cgi?id=650345
2011-05-18 11:53:21 -04: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
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
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
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
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
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
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
Colin Walters
542215b78a Rename g_unix_pipe_flags to g_unix_open_pipe
From IRC discussion, people liked this name more.

https://bugzilla.gnome.org/show_bug.cgi?id=649322
2011-05-03 23:34:17 -04:00
Matthias Clasen
ba5c9bd39f Remove extraneous decorations
Since in a doc comment takes no leading '@'.
2011-05-03 19:15:46 -04:00
Colin Walters
511070fb28 glib-unix.c: Don't leak FDs if pipe2() succeeds 2011-05-03 16:22:13 -04:00
Colin Walters
11bb78105d Use g types in public API for consistency 2011-05-03 10:57:22 -04:00
Colin Walters
ed37970a04 g_unix_set_fd_nonblocking: New API to control file descriptor blocking state
And use it in relevant places in GLib.

https://bugzilla.gnome.org/show_bug.cgi?id=649225
2011-05-03 10:14:48 -04:00
Colin Walters
e08e70e08d glib-unix.h: Unconditionally include unistd.h
danw points out it's part of POSIX.

https://bugzilla.gnome.org/show_bug.cgi?id=649201
2011-05-03 08:37:27 -04:00
Dan Winship
e56498ee0b Fix usage of _GNU_SOURCE
_GNU_SOURCE must be defined before including any other (system)
header, so defining it in glib-unix.h (and hoping no one has included
anything else before that) is wrong. And the "#define _USE_GNU"
workaround for this problem in gnetworkingprivate.h is even wronger
(and still prone to failure anyway due to single-include guards).

Fix this by defining _GNU_SOURCE in config.h when building against
glibc. In theory this is bad because new releases of glibc may include
symbols that conflict with glib symbols, which could then cause
compile failures. However, most people only see new releases of glibc
when they upgrade their distro, at which point they also generally get
new releases of gcc, which have new warnings/errors to clean up
anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=649201
2011-05-03 07:07:41 -04:00
Ray Strode
597ede957a glib/Makefile.am: add gmain-internal.h to sources
It's a new private header.

This commit adds it to the Makefile so it's properly distributed
with the sources.
2011-05-02 14:31:59 -04:00
Dan Winship
bdc23c44e8 Fix compiler warnings 2011-05-02 11:50:23 -04:00
Behdad Esfahbod
c1d61f1971 Bug 648966 - Update g_unichar_iswide and g_unichar_iswide_cjk
Add tests.
2011-05-02 11:43:18 -04:00
Dan Winship
181763438a Update .gitignores 2011-05-02 09:54:15 -04:00
Matthias Clasen
ddcb095fb2 Avoid an unused variable warning
Also, clean up some whitespace
2011-05-01 20:43:04 -04:00
Matthias Clasen
d09df426ba GHash: make sets with refcounted keys work correctly
When keys == values, we have to be careful about the order in
which we replace their elements.
2011-05-01 10:55:24 -04:00
Matthias Clasen
be991170fa GHash: introduce a "set" mode
Make hash tables start out in a mode in which they don't store
values at all, until the first insertion of a non-identical
key-value pair.

This reduces memory requirements by 1/3 when using hash tables
to store sets.

Based on a patch by Morten Welinder,
https://bugzilla.gnome.org/show_bug.cgi?id=644437
2011-04-30 23:11:18 -04:00
Morten Welinder
0ae6bc3aaa GHash: eliminate one of the lookup_nodes functions.
Kill g_hash_table_lookup_node and rename g_hash_table_lookup_node_for_insertion
to g_hash_table_lookup_node.  Since at this point we already check for
toombstones in all callers of g_hash_table_lookup_node this doesn't make
a difference.

https://bugzilla.gnome.org/show_bug.cgi?id=644437
2011-04-30 23:11:18 -04:00
Morten Welinder
6e45153ef7 GHash: split nodes array into seperate arrays.
This reduces memory requirements by 1/6 on 64-bit machines since
no padding is needed.  It also puts less strain on the memory
allocator since we no longer need one giant slab of memory.

https://bugzilla.gnome.org/show_bug.cgi?id=644437
2011-04-30 23:11:18 -04:00
Morten Welinder
4d8e64e6e8 GHash: use macros to check for magic hash values.
https://bugzilla.gnome.org/show_bug.cgi?id=644437
2011-04-30 23:11:18 -04:00
Behdad Esfahbod
acda716d2d Bug 648966 - Update g_unichar_iswide and g_unichar_iswide_cjk
Update to Unicode 6.0.  Also attach Python script that generates
the tables.
2011-04-29 18:03:24 -04:00
Colin Walters
a04efe6afb Use SIGTRAP (via G_BREAKPOINT()) if G_DEBUG=fatal-warnings
On Linux with gdb, it's much more convenient to debug programs using
G_DEBUG=fatal-warnings if we send SIGTRAP instead of abort() by
default.  The default handler for both is to terminate the process.

In particular this makes it more easily possible to debug a warning
that's not the first in a program; you can skip past it and
go to the warning you care about.

The "aborting..." message is removed since it's no longer accurate,
and anyways was never very useful; crashes should show up in ABRT/apport
type crash catching systems.

https://bugzilla.gnome.org/show_bug.cgi?id=648423
2011-04-28 14:48:48 -04:00
Shaun McCance
e585059514 glib/gvariant.c: Fix variable name in example code 2011-04-28 12:41:41 -04:00
Colin Walters
a1fbe7ae84 Drop stray reference to gthread.la
We now build this test multithreaded in gthread/tests.
2011-04-27 19:09:38 -04:00
Colin Walters
7b04bbc8e0 glib/Makefile.am: Remove stray tab 2011-04-27 18:42:29 -04:00
Colin Walters
549d895fa4 glib-unix: New API to watch some Unix signals
This new API allows watching a few select Unix signals;
looking through the list on my system, I didn't see anything
else that I think it'd reasonable to watch.

We build on the previous patch to make the child watch helper thread
that existed on Unix handle these signals in the threaded case.
In the non-threaded case, they're just global variables.

https://bugzilla.gnome.org/show_bug.cgi?id=644941
2011-04-27 16:01:39 -04:00
Colin Walters
920899d78f gmain: Prepare child watch handling for more generic signal handling
In preparation for supporting more Unix signals such as SIGHUP,
SIGTERM etc.,

https://bugzilla.gnome.org/show_bug.cgi?id=644941
2011-04-27 14:58:36 -04:00
Colin Walters
0ff211f520 glib-unix: New Unix-specific API
GLib historically has been designed to be "mostly" portable; there
are some functions only available on Unix like g_io_channel_unix_new(),
but these are typically paired with obvious counterparts for Win32.

However, as GLib is used not only by portable software, but components
targeting Unix (or even just Linux), there are a few cases where it
would be very convenient if GLib shipped built-in functionality.

This initial patch is a basic wrapper around pipe2(), including
fallbacks for older kernels.  This pairs well with the
existing g_spawn_*() API and its child_setup functionality.

However, in the future, I want to add a signal() wrapper here,
complete with proxying the signal to a mainloop.  I have initial code
for this, but doing it sanely (including factoring out gmain.c's
private worker thread), is a complex task, and I don't want to block
on that.

See also gwin32.h for Win32 specific functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=644941
2011-04-27 13:29:38 -04:00
David Schleef
0dc5d45692 Fix %z in g_date_time_format()
https://bugzilla.gnome.org/show_bug.cgi?id=642935
2011-04-27 02:36:12 -04:00
Matthias Clasen
d3b80c49ea GHashTable: Small optimization of remove-all
Don't enter the loop if we are not going to notify anyway.
Pointed out in bug 646013.
2011-04-27 00:03:59 -04:00
Matthias Clasen
fc7403b675 GHashTable: Add a test for remove-all functionality 2011-04-27 00:03:28 -04:00
Matthias Clasen
4832289bc0 Whitespace cleanup 2011-04-26 23:57:17 -04:00
Matthias Clasen
440bd2a975 GSequence: Make g_sequence_iter_move behave as documented
As pointed out in bug 658313, moving before the begin iter is
supposed to return the begin iter, not the end iter. Also add
a test for this behaviour.
2011-04-26 22:08:24 -04:00
Benjamin Otte
d5dc79c0b0 API: testutils: Add g_test_fail()
This allows tests to fail in a nonfatal way and the test runner can
continue if invoked with -k.

https://bugzilla.gnome.org/show_bug.cgi?id=647826
2011-04-18 14:52:29 +02:00
Benjamin Otte
9a12103259 testutils: Sprinkle code with newlines
Readable code ftw!
2011-04-18 14:49:51 +02:00
Benjamin Otte
d259d50afd testutils: Return number of bad tests from g_test_run_suite_internal()
In particular do not return a boolean disguised as an int.
2011-04-18 14:49:51 +02:00
Benjamin Otte
62e68ceec8 testutils: Remove unused variable 2011-04-18 14:49:51 +02:00
Benjamin Otte
19fdb18ef8 testutils: Return a boolean from g_test_case_run()
Return value is intened to be TRUE for success, FALSE for failure.
Currently we return TRUE all the time.
Previously the test returned 0 all the time.
2011-04-18 14:49:51 +02:00
Ryan Lortie
8b03077a44 GTimeZone: fix non-threadsafe refcounting
In the previous code, if the timezone was pulled out of the cache again
just as the last reference was being dropped, the cache code will
increase its refcount and return it while the unref code was freeing it.

Protect against that.

Closes #646435.
2011-04-14 09:56:00 -04:00
Ryan Lortie
4d15ba90c0 G_VARIANT_TYPE_VARDICT: Add 'Since:' tag 2011-04-13 11:46:33 -04:00
Matthias Clasen
0e55346420 Skip the writable test if the file is not writable
Since make distcheck operates on a readonly source tree.
2011-04-13 08:19:35 -04:00
Matthias Clasen
67b8c7ea8a Fix non-srcdir builds 2011-04-13 01:31:19 -04:00
Matthias Clasen
9890c03579 GMarkupParseContext: Improve struct packing 2011-04-12 09:58:13 -04:00
Matthias Clasen
f8b154f53a GMatchInfo: improve struct packing 2011-04-12 09:55:59 -04:00
Matthias Clasen
1a6dd8c7fa Fix a few parameter mismatches in the docs 2011-04-11 13:20:55 -04:00
Dan Winship
784619bc3a Fix two leaks seen when using TLS connections
g_tls_certificate_list_new_from_file() was leaking the file contents,
and GSource was leaking the GSourcePrivate structure that got
created when using child sources.
2011-04-07 08:32:06 -04:00
Murray Cumming
3ac7e0a7fe Docs: Change DBus to D-Bus 2011-04-04 09:22:06 +02:00
Colin Walters
98365dff73 gqsort: Quiet a compiler warning for qsort_r 2011-03-31 17:07:07 -04:00
Colin Walters
14bb138d58 goption: [linux] Look in /proc/self/cmdline for argv0 if not specified
We really shouldn't use <unknown> when we can perfectly easily
get argv0 out of /proc.  This avoids people having to pass argv
down into gtk_init/g_option_context_parse etc., which is important
because GTK+ uses it to initialize the WM_CLASS, which in turn
GNOME Shell consumes for application tracking.

https://bugzilla.gnome.org/show_bug.cgi?id=644309
2011-03-31 15:29:42 -04:00
Ryan Lortie
7a752e0817 Improve .gitignore 2011-03-31 15:51:01 +05:30
Ryan Lortie
0cadce7e93 glib.symbols: add some missing symbols 2011-03-31 15:47:54 +05:30
Ryan Lortie
cd35e2e643 GVariant test: test parsing of "inf" and "nan" 2011-03-31 15:09:55 +05:30
Ryan Lortie
85633f1182 GVariant parser: parse "inf", "-inf" and "nan" 2011-03-31 15:09:26 +05:30
Ryan Lortie
24ed841d6a GVariant parser: match strings without consuming
Add a new function that allows the parser to check that the current
token is equal to a given string without consuming the token.
Reimplement the 'consume' function in terms of the new function.
2011-03-31 14:45:50 +05:30
Ryan Lortie
f6dff49136 GVariant parser: fix memory error
In some cases it was possible for the GVariant parser to access past the
'limit' parameter.  This should fix that.
2011-03-31 14:14:59 +05:30
Ryan Lortie
e9ce8f2374 Add GTimeZoneMonitor
Monitors /etc/localtime for changes and instructs GTimeZone to drop its
cache.  Also has a signal for interested 3rd parties.
2011-03-31 12:47:03 +05:30
Ryan Lortie
de3a3b181a g_time_zone_new_local: cache the result
Add a function to drop the cache.
2011-03-31 12:47:02 +05:30
Ryan Lortie
29a074b87e GTimeZone: don't add /etc/localtime to the cache
It may change.
2011-03-31 12:47:02 +05:30
Murray Cumming
30fdc1a799 Docs: Changed can not to cannot. 2011-03-24 09:33:55 +01:00
Emmanuele Bassi
08f0a31289 Revert "Remove all uses of G_CONST_RETURN"
This reverts commit 36741245cc.

The removal has not been discussed, except on Bugzilla:

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-03-15 09:03:28 +00:00
Emmanuele Bassi
0c1acc7e74 Revert "Deprecate G_CONST_RETURN"
This reverts commit a7fc7909da.

The deprecations was not discussed except on Bugzilla:

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-03-15 09:02:08 +00:00
Ryan Lortie
d679a7659f GVariant parser: fix tuple type checking
Robert Ancell discovered that the GVariant parser messes up pretty badly
when the type of a tuple is specified and the tuple in the text being
parsed has a different number of elements (but otherwise matching child
types).

Check that we have the expected number of elements.

Closes #644786.
2011-03-15 01:32:22 -04:00
Ryan Lortie
a7fc7909da Deprecate G_CONST_RETURN 2011-03-15 01:32:22 -04:00
Ryan Lortie
36741245cc Remove all uses of G_CONST_RETURN
Just use 'const'.
2011-03-15 01:32:22 -04:00
Owen W. Taylor
789b341eff Correct internal definition of C_()
* Since the GLib translations are lazily initialized, we need an
  internal wrapper for g_dpgettext() that does the initialization
  in the same way as glib_gettext()
* We need to use the glib domain defined by GETTEXT_PACKAGE
  rather than than the application's domain.

https://bugzilla.gnome.org/show_bug.cgi?id=644607
2011-03-12 21:10:06 -05:00
Emilio Pozuelo Monfort
89ca0f7296 Document g_timeout_add_seconds first call latency
And fix /timeout/rounding to not fail if the first call
happens after 2 seconds.

https://bugzilla.gnome.org/show_bug.cgi?id=644552
2011-03-12 15:51:44 +00:00
Tor Lillqvist
9505ad05ee Use g_usleep() for portability, bug #644465 2011-03-11 10:19:42 +02:00
Matthias Clasen
a6615ba859 Fix cleanup in g_markup_collect
Patch by Matt Barnes,
https://bugzilla.gnome.org/show_bug.cgi?id=644428
2011-03-10 23:27:49 -05:00
Matthias Clasen
949b7c3428 Add a testcase for g_markup_collect cleanup
Taken from https://bugzilla.gnome.org/show_bug.cgi?id=644428.
The test is currently failing.
2011-03-10 23:25:22 -05:00
Martin Nordholts
37858f7f5e Check availability of linux/magic.h
Check availability of linux/magic.h. It isn't available in Linux
versions before 2.6.19.
2011-03-08 19:13:57 +01:00
Matthias Clasen
121ce56fe1 Go back to the old logic in set_expiration
It was more complicated, but also more correct...
Also add a test to ensure that our rounding works as expected.
https://bugzilla.gnome.org/show_bug.cgi?id=643795
2011-03-06 22:38:17 -05:00
Ryan Lortie
d2a2fe96a3 GVariant docs cleanups
Fix some gtk-doc warnings
2011-03-04 00:57:51 -05:00
Ryan Lortie
be04e514c0 GVariant: add G_VARIANT_TYPE_VARDICT for a{sv} 2011-03-04 00:45:14 -05:00
Matthias Clasen
c430ad0b1b Add some tests for g_hash_table_lookup_extended 2011-02-25 10:41:29 -05:00
Matthias Clasen
d2d756439f GHashTable: Clarify g_hash_table_lookup_extended docs
Passing NULL as a key is only ok if your hash and equal functions
can deal with it.
https://bugzilla.gnome.org/show_bug.cgi?id=642944
2011-02-25 10:40:39 -05:00
Matthias Clasen
52ef73ac8c GOptionContext: Warn about invalid arg/flag combinations
This was proposed by Kjell Ahlstedt in bug 642825.
Also adding a few tests for this new behaviour.
2011-02-25 10:10:37 -05:00
Matthias Clasen
ee9e38ef68 Treat optional arguments the same for long and short options
This was noticed in bug 642825 and the change was proposed
by Kjell Ahlstedt.
2011-02-25 08:45:28 -05:00
Chun-wei Fan
701ac3cb3d Fix the VS2010 project generation for GLib
The scripts accently pick up gcc-only source files... this fixes that.
2011-02-24 12:38:51 +08:00
Andreas Rottmann
fdfb09a793 Bug 638185 - GIOCondition should be annotated as "flags"
Add a gtk-doc annotation to GIOCondition marking it as a flags type.
2011-02-22 15:12:30 +01:00
Chun-wei Fan
7b118b0c41 Visual C++ 2010 Project Files: autotools files
These are the updates to the autotools files to
ensure the expansion of the GIO, GLib and GObject
project files (*.vcxproj, *.vcxproj.filters) and to
enable the distribution of the VS2010 project files

The actual VS2010 project files will follow shortly
2011-02-22 19:58:18 +08:00
Tor Lillqvist
1158f9c171 Export _glib_get_locale_dir() as it is now used in gio, too 2011-02-20 01:30:51 +02:00
Matthias Clasen
4cda703d8e Use glibc qsort_r() for g_qsort_with_data()
No point in using an outdated copy that claims to
'work best on a Sun 4/260' when we can just wrap qsort_r...
2011-02-16 01:28:27 -05:00
Damien Lespiau
59cbb3a8a3 gtimezone: Rename shadowing variable 'time' to 'time_' 2011-02-15 21:55:38 -05:00
Matthias Clasen
b21b3a01c7 Fix bug base in array-test 2011-02-15 00:03:19 -05:00
Matthias Clasen
a46885242b Add a testcase for bug 640489 2011-02-15 00:03:19 -05:00
Ryan Lortie
c2fbef4125 Bug 642052 - g_timeout_add(_seconds) overflow
Fix integer overflow error.
2011-02-14 23:23:33 -05:00
Ryan Lortie
10154d21f0 Bug 642052: add currently-broken test case
The test case fails for now.  It will be fixed by the next commit.
2011-02-14 23:23:33 -05:00
Matthias Clasen
309f5f978b Improve test coverage
Various test additions, mainly in GObject
2011-02-13 23:49:19 -05:00
Matthias Clasen
147139d968 Use g_assert_no_error
The option-context test had its own version.
2011-02-13 23:49:18 -05:00
Benjamin Otte
562f29afdc doc: Fix typo in previous commit
Yuck. I blame it on the weekend.
2011-02-12 18:05:54 +01:00
Benjamin Otte
17eea8fa60 docs: Fix return value for g_datetime_compare()
Previous code confused dt1 and dt2. The new formulation is stolen from
man strcmp() and g_strcmp0().
2011-02-12 17:56:34 +01:00
Ryan Lortie
ea4e3ea1cb GVariant: doc the format of g_variant_parse/print 2011-02-11 13:53:10 -05:00
Ryan Lortie
b1d02f9323 GVariant: support NULL for empty arrays in varargs
g_variant_new("as", NULL); now gives an empty array of strings, for
example.

This was documented as working already, but was never actually
implemented (due to the fact that it muddies the water when considering
maybe types).  It's being implemented now because its convenience to
programmers exceeds any damage done to the conceptual purity of the API.
2011-02-11 10:14:29 -05:00
Matthias Clasen
78dcafc5cb Fix some parameter mismatches in GVariant docs 2011-02-08 10:04:36 -05:00
Matthias Clasen
4368a07e02 Avoid more compiler warnings 2011-02-08 07:41:49 -05:00
Matthias Clasen
8d572f5d22 g_date_time_format: drop an unused variable 2011-02-08 07:35:54 -05:00
Javier Jardón
a0554a9f76 docs: Document Since properly, 2.26 -> 2.28 2011-02-08 02:27:44 +00:00
Johan Dahlin
fdaaa22b58 Correct gtk-doc SECTION: syntax
g-ir-scanner does not allow a space between the : and the
section name.
2011-02-01 16:18:02 -02:00
Ignacio Casal Quinteiro
401a4233e4 Check that error exists before trying to set it. Fixes bug #640975. 2011-01-31 13:34:26 +01:00
Dan Winship
3c59c38404 Fix g_source_add_child_source docs
https://bugzilla.gnome.org/show_bug.cgi?id=640823
2011-01-28 10:18:42 -05:00
Ryan Lortie
d4209c1c41 GVariant: clear memory before releasing it
Bug #640807 makes a reasonable case for why it's better to have your
program crash outright in the case of memory errors.  With this
modification, GVariant is far more likely to do that in the case that a
GVariant pointer is used shortly after being freed.
2011-01-28 08:25:05 -05:00
Tobias Mueller
8602a3a682 Fixed format string issue in a test, fixes bug 640725 2011-01-27 23:10:02 -05:00
Matthias Clasen
069daa69f6 Add testcase for bug 640695 2011-01-27 23:07:53 -05:00
Benjamin Gilbert
440e6f4a61 Ensure g_key_file_load_from_file() strips a \r on a 4 KB boundary
When g_key_file_parse_data() encountered \n, it was checking the previous
character in the current input buffer for a \r to erase, rather than the
previous character in the parse buffer.  If g_key_file_load_from_file()
was given a file with a \r\n sequence straddling a 4 KB boundary, the \n
would be the first character in the input buffer, so the \r would not be
properly stripped.

Bug #640695.

Found-by: Jan Harkes <jaharkes@cs.cmu.edu>
2011-01-27 23:06:15 -05:00
Matthias Clasen
cc5578fbd7 Make load_user_special_dirs() resistant to nonexistent dirs 2011-01-27 21:57:57 -05:00
Matthias Clasen
fb2809ec99 Forgotten files 2011-01-22 00:01:54 -05:00
Matthias Clasen
3f059a6a12 Remove a test that seems to fail depending on time of day 2011-01-21 23:41:12 -05:00
Matthias Clasen
c03dc6bf7d Update the included copy of PCRE
Update PCRE to version 8.12.
At the same time, also add Unicode 6.0 script support.
2011-01-21 23:10:01 -05:00
Behdad Esfahbod
0a57086540 Update to Unicode 6.0
One new GUnicodeBreak enum member.  Three new GUnicodeScript members,
and one member renamed to fix a typo.

Tests, docs, and scripts are updated.  PCRE update still needed.
2011-01-21 16:30:19 -05:00
Matthias Clasen
c7f38cd277 Mark another function as static 2011-01-18 00:06:55 -05:00
Matthias Clasen
67e112cce6 Mark a function as static 2011-01-18 00:06:05 -05:00
Matthias Clasen
d2347f34fd Move GMarkup docs inline 2011-01-17 23:46:20 -05:00
Ray Strode
e8120dc4ce datetime: Show 12 instead of 0 for 12h hour format
The 12h mode hour format is computed by taking the
24h mode hour format modulo 12.

The conversion results in 12 noon getting erroneously
converted to 0.

This commit makes noon get the same special handling
as midnight.
2011-01-17 14:31:34 -05:00
Ray Strode
a437c5e768 tests: add format test case for noon hour in 12h mode
It currently displays it as "0" instead of "12", so this
test case demonstrates the bug.
2011-01-17 14:31:34 -05:00
Javier Jardón
a583405f66 docs: gvariant-core: g_variant_normalise -> g_variant_get_normal_form() 2011-01-14 17:54:04 +00:00