summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* gmem.h: Use __typeof__() in the g_clear_pointer() macrotype-safe-g-clear-pointer-1425Iain Lane2018-07-121-0/+11
| | | | | | | | | | | | | Type punning is used on the existing implementation, which hides errors such as: GSList *list = NULL; g_clear_pointer (&list, g_error_free); Let's use __typeof__ to cast the passed-in pointer before it's passed to the free function so it trips -Wincompatible-pointer-types if it's wrong. Fixes #1425
* gobject: Make g_clear_object take a non-volatile GObject **Iain Lane2018-07-123-3/+3
| | | | | | | | The implementation is silently discarding this anyway, and g_object_unref() is using atomic operations. So this should be safe. Having this here triggers -Wdiscarded-qualifiers when g_clear_pointer() is fixed to use __typeof__().
* Merge branch 'revert-08f41d80' into 'master'Emmanuele Bassi2018-07-114-14/+3
|\ | | | | | | | | Revert "Merge branch 'type-safe-g-clear-pointer-1425' into 'master'" See merge request GNOME/glib!176
| * Revert "Merge branch 'type-safe-g-clear-pointer-1425' into 'master'"Emmanuele Bassi2018-07-114-14/+3
|/ | | This reverts merge request !165
* Updated Slovenian translationMatej Urbančič2018-07-111-179/+187
|
* Merge branch '640-appinfo-skip-display' into 'master'Emmanuele Bassi2018-07-111-1/+1
|\ | | | | | | | | | | | | tests: Fix skipping of appinfo tests when DISPLAY is unset Closes #640 See merge request GNOME/glib!171
| * tests: Fix skipping of appinfo tests when DISPLAY is unsetPhilip Withnall2018-07-111-1/+1
| | | | | | | | | | | | | | | | | | Use g_test_skip() so that the TAP output is correct for the tests, rather than printing using g_printerr(). Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/640
* | Merge branch 'type-safe-g-clear-pointer-1425' into 'master'Philip Withnall2018-07-114-3/+14
|\ \ | | | | | | | | | | | | | | | | | | gmem.h: Use __typeof__() in the g_clear_pointer() macro Closes #1425 See merge request GNOME/glib!165
| * | gmem.h: Use __typeof__() in the g_clear_pointer() macroIain Lane2018-07-111-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Type punning is used on the existing implementation, which hides errors such as: GSList *list = NULL; g_clear_pointer (&list, g_error_free); Let's use __typeof__ to cast the passed-in pointer before it's passed to the free function so it trips -Wincompatible-pointer-types if it's wrong. Fixes #1425
| * | gobject: Make g_clear_object take a non-volatile GObject **Iain Lane2018-07-113-3/+3
| |/ | | | | | | | | | | | | | | The implementation is silently discarding this anyway, and g_object_unref() is using atomic operations. So this should be safe. Having this here triggers -Wdiscarded-qualifiers when g_clear_pointer() is fixed to use __typeof__().
* | Merge branch 'sign-compare' into 'master'Philip Withnall2018-07-114-20/+27
|\ \ | | | | | | | | | | | | Fix some -Wsign-compare warnings See merge request GNOME/glib!162
| * | gvariant: Fix -Wsign-compare warningsPhilip Withnall2018-07-111-4/+7
| | | | | | | | | | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * | grand: Fix -Wsign-compare warningPhilip Withnall2018-07-101-1/+1
| | | | | | | | | | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * | gqueue: Fix -Wsign-compare warningsPhilip Withnall2018-07-101-3/+3
| | | | | | | | | | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * | garray: Fix -Wsign-compare warningsPhilip Withnall2018-07-101-12/+16
| | | | | | | | | | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | Merge branch '1044-prlimit-fix' into 'master'Philip Withnall2018-07-111-3/+4
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | Fix prlimit() error handling in tests Closes #1044 See merge request GNOME/glib!164
| * | tests: Fix error reporting on prlimit() call failurePhilip Withnall2018-07-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | prlimit() returns its error code in errno, not as a return value. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/1044
* | | Merge branch '927-resource-path-fix' into 'master'Emmanuele Bassi2018-07-112-24/+63
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | gresource: Fix potential array overflow if using empty paths Closes #927 See merge request GNOME/glib!150
| * | | gresource: Fix potential array overflow if using empty pathsPhilip Withnall2018-07-052-15/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds tests to cover this case and similar cases for various GResource methods in future. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/927
| * | | gresource: Fix wrapping of function return typePhilip Withnall2018-07-051-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | This introduces no functional changes. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | | Merge branch '1402-real-time' into 'master'Philip Withnall2018-07-117-22/+33
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glib: Don’t use time(NULL) to get current time Closes #1402 See merge request GNOME/glib!154
| * | | | glib: Don’t use time(NULL) to get current timePhilip Withnall2018-07-097-22/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use either g_get_real_time() or g_date_time_new_now_local(). This means we don’t need to worry about time_t being 32b in future (the year 2038 problem), and it makes the need for error handling a bit more explicit. Improve the error handling in several cases. Based on a patch by Niels De Graef (https://gitlab.gnome.org/GNOME/glib/merge_requests/142). Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/1402
* | | | | Merge branch '340-gdbus-fixme' into 'master'Iain Lane2018-07-101-9/+0
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove an outdated TODO comment Closes #340 See merge request GNOME/glib!168
| * | | | | gdbusconnection: Drop an outdated TODO commentPhilip Withnall2018-07-101-9/+0
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/340
* | | | | Merge branch '1041-atomic-bad-function-cast' into 'master'Emmanuele Bassi2018-07-104-5/+17
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | Allow g_atomic_pointer_get() to be used by projects which enable -Wbad-function-cast Closes #1041 See merge request GNOME/glib!166
| * | | | gatomic: Tweak __atomic_load*() calls to work with -Wbad-function-castPhilip Withnall2018-07-104-5/+17
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When compiling third-party projects with -Wbad-function-cast, the inline g_atomic_pointer_get() implementation which uses C11 __atomic_load*() calls on GCC was causing compilation errors like: error: cast from function call of type ‘long unsigned int’ to non-matching type ‘void *’ While we don’t want to compile all of GLib with -Wbad-function-cast, we should support its headers being included in projects which do enable that warning. It doesn’t seem to be possible to cast away the warning (e.g. by casting the function’s result through (void)), so we have to assign to an intermediate integer of the right size first. The same has to be done for the bool return value from __sync_bool_compare_and_swap(). In that case, casting from bool to gboolean raises a -Wbad-function-cast warning, since gboolean is secretly int. The atomic tests have been modified to enable -Wbad-function-cast to catch regressions of this in future. The GLib build has conversely been modified to set -Wno-bad-function-cast, just in case people have it set in their environment CFLAGS. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/1041
* | | | Merge branch 'wip/hughsie/g_ref_string_new_len' into 'master'Philip Withnall2018-07-094-0/+76
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Add a g_ref_string_new_len() to allow creating from non-NUL byte arrays See merge request GNOME/glib!158
| * | | | Add a g_ref_string_new_len() to allow creating from non-NUL byte arraysRichard Hughes2018-07-094-0/+76
| | |_|/ | |/| | | | | | | | | | | | | | | | | | A lot of GLib APIs provide a string length and explicitly say that the strings are not NUL terminated. For instance, parsing XML using GMarkupParser or reading packed binary strings from mmapped data files.
* | | | Merge branch '1201-inotify-linking' into 'master'Philip Withnall2018-07-092-1/+5
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | Resolve "Linking failure on midipix with slibtool" Closes #1201 See merge request GNOME/glib!157
| * | | gio: Link inotify file monitor to GLib and GObjectPhilip Withnall2018-07-092-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently this is needed for building PE libraries. It makes no difference on Linux, where linking of the GLib symbols in the inotify file monitor code is done lazily. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/1201
* | | | Merge branch 'refcount-box' into 'master'Emmanuele Bassi2018-07-0919-0/+1717
|\ \ \ \ | |/ / / |/| | | | | | | | | | | Reference counted data allocations See merge request GNOME/glib!92
| * | | Update rcbox annotations for acquire/release functionsEmmanuele Bassi2018-07-092-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The accepted behaviour for reference counting functions can be described as such: - acquire: takes a pointer to a memory area and returns the same pointer with its reference count increased; this means that the returned value's ownership is fully transfered from the callee to the caller - release: takes a pointer to a memory area and drops the reference count; this means that the caller transfers the ownership of the argument to the callee These annotations are mostly meant for documentation purposes: high level language bindings are unlikely to use them, as they have their own reference counting semantics on top of GLib's own, and they should not expose this API to their own consumers.
| * | | Increase coverage of atomic refcounted dataEmmanuele Bassi2018-07-091-0/+85
| | | | | | | | | | | | | | | | | | | | We are not testing the API directly, and this leads to holes in the code coverage.
| * | | Increase coverage for GRefStringEmmanuele Bassi2018-07-091-0/+12
| | | | | | | | | | | | | | | | | | | | We still have some holes in the code coverage of the GRefString test suite.
| * | | Add missing trasfer annotation for g_ref_string_new()Emmanuele Bassi2018-07-091-1/+1
| | | | | | | | | | | | | | | | We don't have one, but we ought to.
| * | | Allow empty strings to be refcountedEmmanuele Bassi2018-07-091-5/+5
| | | |
| * | | Add systemtap probes to refcounted dataEmmanuele Bassi2018-07-094-0/+67
| | | | | | | | | | | | | | | | Probes allow us to debug refcounting bugs.
| * | | Fix the implementation of interned refstringsEmmanuele Bassi2018-07-091-15/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The global hash table we use for interned strings should not own a reference on the strings themselves, as otherwise we'd leak them all over the place. Instead, it should keep a "weak" reference to them; once the last strong reference goes away, we drop remove the weak reference from the hash table.
| * | | Add missing copyright noticeEmmanuele Bassi2018-07-091-0/+18
| | | |
| * | | Check for overflow when allocating RcBoxEmmanuele Bassi2018-07-093-5/+9
| | | | | | | | | | | | | | | | | | | | Since we're over-allocating the passed block size, we need to check that we're not overflowing gsize when computing the actual allocation size.
| * | | Allow NULL clear function when releasing referencesEmmanuele Bassi2018-07-092-22/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both g_rc_box_release_full() and g_atomic_rc_box_release_full() should allow passing NULL as the clear function, to conform to the existing coding practices in GLib. Additionally, this allows us to reimplement release() in terms of release_full(), and improve test coverage.
| * | | Improve docs for g_rc_box/g_atomic_rc_boxEmmanuele Bassi2018-07-092-43/+33
| | | | | | | | | | | | | | | | | | | | Especially the preconditions and the annotations for the returned values.
| * | | Rename g_arc_box to g_atomic_rc_boxEmmanuele Bassi2018-07-093-67/+67
| | | | | | | | | | | | | | | | Makes the API more self-explanatory.
| * | | Add length accessor for GRefStringEmmanuele Bassi2018-07-094-0/+23
| | | | | | | | | | | | | | | | | | | | Since we store the size of the allocation in the underlying ArcBox, we can get a constant time getter for the length of the string.
| * | | Add size accessor to RcBox and ArcBoxEmmanuele Bassi2018-07-095-0/+55
| | | | | | | | | | | | | | | | | | | | It may be useful to know how big a reference counted allocation is outside of internal checks.
| * | | Add reference counted stringsEmmanuele Bassi2018-07-0912-0/+308
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last part of the reference counting saga. Now that we have: - reference counter types - reference counted allocations we can finally add reference counted strings using reference counted allocations to avoid creating a new String type, and reimplementing every single string-based API.
| * | | Improve the RcBox and ArcBox documentationEmmanuele Bassi2018-07-092-51/+105
| | | | | | | | | | | | | | | | | | | | Use better examples, split up into sections, and mention use with g_autoptr().
| * | | Make g_rc_box_dup()/g_arc_box_dup() more genericEmmanuele Bassi2018-07-094-33/+103
| | | | | | | | | | | | | | | | | | | | | | | | It's more useful to have a dup() function that copies any blob of memory into a reference counted allocation, than to have a dup() that only copies a reference counted allocation.
| * | | Add atomically refcounted dataEmmanuele Bassi2018-07-098-32/+447
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GArcBox is the atomic reference counting version of GRcBox. Unlike GRcBox, the reference acquisition and release on GArcBox are guaranteed to be atomic, and thus they can be performed from different threads. This is similar to Rust's Arc<Box<T>> combination of traits.
| * | | Add refcounted dataEmmanuele Bassi2018-07-0910-0/+555
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is useful to provide a "reference counted allocation" API that can add reference counting semantics to any memory allocation. This allows turning data structures that usually are placed on the stack into memory that can be placed on the heap without: - adding a public reference count field - implementing copy/free semantics This mechanism is similar to Rust's Rc<Box<T>> combination of traits, and uses a Valgrind-friendly overallocation mechanism to store the reference count into a private data segment, like we do with GObject's private instance data.