* glib/gtestutils.h (g_assert_no_error, g_assert_error): Macros to
assert that a GError is not set, or else is set to a particular
error.
* glib/gtestutils.c (g_assertion_message_error): utility for
those macros
* glib/tests/keyfile.c:
* tests/asyncqueue-test.c:
* tests/bookmarkfile-test.c:
* tests/convert-test.c:
* tests/file-test.c: Use g_assert_error/g_assert_no_error
svn path=/trunk/; revision=7555
Bug 509446 - portable blocking gio cancellation
* gcancellable.c (g_cancellable_make_pollfd): New method to make a
GPollFD for a cancellable (which is slightly more complicated on
Windows than Unix).
* gunixinputstream.c (g_unix_input_stream_read):
* gunixoutputstream.c (g_unix_output_stream_write): Use
g_cancellable_make_pollfd() and g_poll() rather than using poll()
directly.
* tests/unix-streams.c: test of GUnixInputStream,
GUnixOutputStream, and GCancellable.
svn path=/trunk/; revision=7553
* glib/gthreadpool.c (wakeup_thread_marker): make this a "const
gpointer" rather than a gconstpointer to avoid warnings later
* glib/pcre/pcre_ucp_searchfuncs.c:
* glib/pcre/pcre_valid_utf8.c: #include "config.h"
* glib/tests/printf.c (test_d): fool gcc into not warning about
some printf format strings that we know are dubious
svn path=/trunk/; revision=7552
* gdesktopappinfo.c (get_all_desktop_entries_for_mime_type): add a
cast to stop a gcc warning
* gfile.c (g_file_copy_attributes): add parens to stop a gcc
warning
svn path=/trunk/; revision=7550
2008-09-26 Tor Lillqvist <tml@novell.com>
* gmodule-win32.c: Improve error reporting: When g_module_open()
fails, include the name of the module passed to LoadLibrary() in
what g_module_error() returns.
svn path=/trunk/; revision=7543
2008-09-25 Tor Lillqvist <tml@novell.com>
Bug 553820 - gpoll.c: undeclared identifier
* glib/gmain.c
* glib/gpoll.c: Make the g_poll() function non-static also on
Windows. Prefix an underscore to the g_main_poll_debug variable
and make it non-static in gmain.c so that it can be used in
gpoll.c. Add back missing variable declaration.
svn path=/trunk/; revision=7542
* gcancellable.c (g_cancellable_class_init): Add a note to the
"cancelled" signal docs warning about thread-safety issues
(g_cancellable_cancel): Note that cancelling an asynchronous
operation takes effect asynchronously, not immediately.
svn path=/trunk/; revision=7541
2008-09-25 Tor Lillqvist <tml@novell.com>
* glib/gspawn-win32.c (do_spawn_with_pipes) (do_spawn_directly):
Just ignore the child_setup function, never call it. The is no
situation in which it could be useful on Windows. Do print a
warning, like before.
* glib/gspawn.c (g_spawn_async_with_pipes): Corresponding change
in documentation.
svn path=/trunk/; revision=7540
2008-09-24 Sven Herzberg <sven@imendio.com>
Be a little more explcit in the docs. Includes Owen's requested
changes.
* glib/gmain.c: improved documentation for g_source_attach() and
g_source_destroy()
svn path=/trunk/; revision=7539
2008-09-23 Michael Natterer <mitch@imendio.com>
* glib/glib.h: #include <glib/gpoll.h>
* glib/gpoll.h: #error out if gpoll.h is included directly.
* glib/gpoll.c: remove trailing whitespace.
svn path=/trunk/; revision=7537
* glib/gpoll.c (g_poll): Move this out of gmain.c and make it part
of the public API. (Part of Bug 505361 - gunixinputstream.c assumes
poll() available.)
svn path=/trunk/; revision=7536
* glib/gpoll.c (g_poll): Move this out of gmain.c and make it part
of the public API. (Part of Bug 505361 - gunixinputstream.c
assumes poll() available.)
svn path=/trunk/; revision=7535
2008-09-23 Tor Lillqvist <tml@novell.com>
* glib/gmain.c (poll_rest) [Win32]: Fix embarrassing bug: I was
passing an incorrect third parameter to memmove(), had forgotten
to multiply by the size of the table entry. Just use a for loop
instead, clearer. Odd I didn't notice when testing this code.
svn path=/trunk/; revision=7533
2008-09-19 Hans Petter Jansson <hpj@novell.com>
Rewrite most of GHashTable to use open addressing with quadratic
probing instead of chaining. This has the potential to reduce memory
fragmentation significantly, while being slightly faster due to
better locality and no need to call alloc/free functions for nodes.
Benchmarks suggest it also uses less memory overall.
* glib/ghash.c (prime_mod): Table of suitable primes for
initial-probe distribution.
(g_hash_table_set_shift): New function.
(g_hash_table_find_closest_shift): New function.
(g_hash_table_set_shift_from_size): New function.
(g_hash_table_lookup_node_for_insertion): New function.
(g_hash_table_lookup_node): Rewritten to return node index instead of
pointer, use quadratic probe on flat table, and not return insertion
data. The latter saves some computation for read-only lookups.
(g_hash_table_remove_node): Rewrite to take a pointer directly to the
node structure to remove, and clear that. Remove unlinking code.
(g_hash_table_remove_all_nodes): Rewrite to not clear nodes
individually, but en masse using memset () after potentially calling
notify functions.
(iter_remove_or_steal): Use new data structure and algorithm. Vastly
simplified - now just a call to g_hash_table_remove_node ().
(g_hash_table_resize): New resize code, re-indexing with new prime
and cleaning up tombstones.
(g_hash_table_maybe_resize): Table may hold 8 buckets minimum, no less
than 1/4 load excluding tombstones, and no more than 15/16 load
including tombstones. These numbers are the results of a lot of
benchmarking with multiple complex applications, and should not be
changed lightly.
(g_hash_table_iter_next)
(g_hash_table_lookup)
(g_hash_table_lookup_extended)
(g_hash_table_insert_internal)
(g_hash_table_remove_internal)
(g_hash_table_foreach_remove_or_steal)
(g_hash_table_foreach)
(g_hash_table_find)
(g_hash_table_get_keys)
(g_hash_table_get_values): Use new data structure and algorithm,
fairly trivial changes.
svn path=/trunk/; revision=7518
2008-09-19 Tor Lillqvist <tml@novell.com>
* glib/gutils.c (_glib_get_dll_directory)
* glib/gspawn-win32.c (do_spawn_with_pipes): Be a bit less
restrictive, look for the helper programs in the same folder where
the GLib DLL is, not necessarily in a "bin" subfolder of the top
GLib installation folder.
svn path=/trunk/; revision=7511
2008-09-16 Michael Natterer <mitch@imendio.com>
* gcontenttype.c (g_content_type_guess): can't assign the return
value of g_strdupv() to an array. Fill the array manually with
const strings instead (it is never freed anyway). Fixes the
build. Also fixed indentation.
svn path=/trunk/; revision=7501
2008-09-16 Wouter Bolsterlee <wbolster@svn.gnome.org>
* gdesktopappinfo.c (g_desktop_app_info_new_from_keyfile):
Fix trivial typo to unbreak the build (there was a colon
instead of a semicolon at the end of a statement).
svn path=/trunk/; revision=7500
2008-09-16 Tor Lillqvist <tml@novell.com>
* win32/vs9: New folder. Project files for use with MSVS9. Based
on the MSVS8 project files is win32/vs8. Four configurations:
Debug|Win32, Release|Win32, Debug|x64 and Release|x64. DLL names
simplified to of the style glib-2-vs9.dll.
svn path=/trunk/; revision=7497
2008-09-16 Tor Lillqvist <tml@novell.com>
* glib/gtimer.c (g_time_val_to_iso8601): time_t is 64 bits in all
the newer Microsoft C libraries, not just 64-bit ones. So to avoid
crash if compiled with newer MSVSes, use a separate time_t
variable in all cases on Windows.
svn path=/trunk/; revision=7496
2008-09-16 Tor Lillqvist <tml@novell.com>
* glib/gbacktrace.h: Define G_BREAKPOINT() also for 64-bit MSVC,
using the __debugbreak() intrinsic.
svn path=/trunk/; revision=7495
* gcontenttype.c (g_content_type_guess): Check whether there's a '/'
at the end of the filename, and declare it a directory.
Patch by Bastien Nocera
svn path=/trunk/; revision=7491