Commit Graph

25325 Commits

Author SHA1 Message Date
Philip Withnall
04803944a3 Merge branch 'skip-debug-only-tests' into 'main'
testsuite: Make tests not fail in !debug builds

Closes #2656

See merge request GNOME/glib!2699
2022-05-28 19:53:22 +00:00
Matthias Clasen
3db1d260ee testsuite: Make tests not fail in !debug builds
Some of our tests rely on on warning that only
occur in debug builds. Skip them in non-debug
builds.

Fixes: #2656
2022-05-28 08:02:16 -04:00
Philip Withnall
43ac055a46 2.73.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-27 18:24:35 +01:00
Philip Withnall
6fdc4275f3 Merge branch 'nano' into 'main'
Add functionality to preserve nanosecond timestamps

Closes #369

See merge request GNOME/glib!2176
2022-05-27 17:01:22 +00:00
Philip Withnall
18c0088678 tests: Fix a memory leak when abandoning a file creation time test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-27 17:45:03 +01:00
Philip Withnall
b7b10cc7e0 tests: Add additional tests for nanosecond precision file timestamps
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #369
2022-05-27 17:45:03 +01:00
nitinosiris
b33ef610de Add functionality to preserve nanosecond timestamps
file copy doesn't preserve nanosecond timestamps

Closes #369
2022-05-27 17:03:35 +01:00
Philip Withnall
7ad6b05458 gfileinfo: Split out a g_file_info_remove_value() helper function
This introduces no functional changes but will make refactoring a bit
easier in the following commit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-27 16:56:10 +01:00
Philip Withnall
a922f2f2c7 Merge branch 'th/g-ptr-array-set-null-terminated' into 'main'
array: add support for g_ptr_array_null_terminated()

See merge request GNOME/glib!1485
2022-05-27 15:08:50 +00:00
Thomas Haller
ee247c0a2d array: add support for %NULL termination in GPtrArray
GArray supports a "zero_terminated" flag, but GPtrArray doesn't.
This is odd, because especially for a pointer array it makes sense
to have a %NULL sentinel. This would be for example useful to track
or construct a strv array with a GPtrArray.

As workaround for this missing feature you could use a GArray instead
(ugly) or to explicitly add the %NULL element. However the latter increases
the "len" of the array, which can be problematic if you want to still use
the GPtrArray for other purposes.

Add API for marking a GPtrArray as %NULL terminated. In that case, the
API will ensure that there is always a valid %NULL sentinel after the
array. Note that the API does not enforce that a %NULL terminated API
actually has any data allocated. That means, even with a %NULL terminated
array, pdata can still be %NULL (only if len is zero).

Add g_ptr_array_new_null_terminated() constructor. The null-terminated flag
cannot be cleared. Once the GPtrArray is flagged to be %NULL terminated, it
sticks. The purpose is that once a user checks whether a GPtrArray instance
is safe to be treated as a %NULL terminated array, the decision does
not need to be re-evaluated.

Also add a g_ptr_array_is_null_terminated(). That is useful because it
allows you to check whether a GPtrArray created by somebody else is safe
to use as a %NULL terminated array. Since there is no API to make an
array not %NULL terminated anymore, this is not error prone.

The new flag is tracked as a guint8 in GRealPtrArray. On common 64 bit
architectures this does not increase the size of the struct as it fits
in an existing hole. Note that this is not a bitfield because it's
probably more efficient to access the entire guint8. However, there is
still a 3 bytes hole (on common 32 and 64 architectures), so if we need
to add more flags in the future, we still have space for 24 bits,
despite the new flag not being a bitfield.

The biggest downside of the patch is the runtime overhead that most
operations now need to check whether %NULL termination is requested.

Includes some tweaks and additional tests by Philip Withnall.

https://gitlab.gnome.org/GNOME/glib/-/issues/353
2022-05-27 15:27:19 +01:00
Philip Withnall
a9321c3652 garray: Add missing (transfer full) introspection annotations
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-27 14:27:52 +01:00
Emmanuele Bassi
1c7966b58e Merge branch 'source-once-no-allocs' into 'main'
gmain: Refactor idle-once and timeout-once to avoid a closure allocation

See merge request GNOME/glib!2693
2022-05-27 12:51:15 +00:00
Philip Withnall
6db112f9a7 gmain: Refactor idle-once and timeout-once to avoid a closure allocation
Instead store a bit inside `GTimeoutSource` and `GIdleSource` to
indicate that they are one-shot sources, and that their callbacks have a
different type and should always be assumed to return `G_SOURCE_REMOVE`.

This should make one-shot idle and timeout sources a teeny weeny little
bit cheaper to set up.

From a suggestion here: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2684#note_1462917

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-27 13:28:33 +01:00
Philip Withnall
c1477f79e7 gmain: Factor out common GIdleSource code
This allows it to be reused and extended (internally) a little more.
This commit introduces no functional changes, but allows for more easy
additions in a following commit.

It introduces `GIdleSource` as a simple wrapper around `GSource`, which
will be extended in a following commit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-27 13:28:33 +01:00
Philip Withnall
af02a614a2 gmain: Factor out common GTimeoutSource code
This allows it to be reused and extended (internally) a little more.
This commit introduces no functional changes, but allows for more easy
additions in a following commit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-27 13:28:33 +01:00
Philip Withnall
93bf87528d Merge branch 'ebassi/source-once' into 'main'
Add one-shot idle and timeout functions

See merge request GNOME/glib!2684
2022-05-27 12:25:51 +00:00
Philip Withnall
c1f94cd1a5 gmain: Minor documentation updates to idle-once and timeout-once funcs
As suggested on !2684.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-27 12:58:10 +01:00
Emmanuele Bassi
50c316ef36 Port various timeout/idle callbacks to the once API
So we excercise it in our test coverage.
2022-05-27 12:58:10 +01:00
Emmanuele Bassi
12571a0821 Add one-shot idle and timeout functions
Many idle and timeout sources are installed as "one shot": called once
and immediately removed. While it's easy to write a simple callback that
returns G_SOURCE_REMOVE, it would also be useful to have some sort of
"visual" marker when reading the code; a way to immediately see that a
callback (which may be defined elsewhere in the code) is meant to be
invoked just once.

Includes additional unit tests by Philip Withnall.
2022-05-27 12:57:55 +01:00
Philip Withnall
87646793e7 tests: Drop redundant collate test data files
These were made redundant in 5b08ef84e4
and cddce179f5,
when the test data was moved into the test program as strings.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-26 19:50:05 +01:00
Philip Withnall
81fd75b4bb Merge branch 'move_gobject_tests' into 'main'
Moving gobject tests from tests/gobjects to gobjects/tests

See merge request GNOME/glib!2550
2022-05-26 18:37:19 +00:00
Emmanuel Fleury
4e02be948b Moving gobject tests from tests/gobjects to gobjects/tests
The test files concerned are:

- tests/gobjects/accumulator.c
- tests/gobjects/defaultiface.c
- tests/gobjects/deftype.c
- tests/gobjects/dynamictype.c
- tests/gobjects/override.c
- tests/gobjects/references.c
- tests/gobjects/signals.c
- tests/gobjects/singleton.c

Related to issue #1434
2022-05-26 19:13:19 +01:00
Emmanuel Fleury
a8baa8d0d8 Convert tests/gobject/singleton.c to glib test framework 2022-05-26 19:13:19 +01:00
Emmanuel Fleury
d0577293a2 Convert tests/gobject/signals.c to glib test framework 2022-05-26 19:13:19 +01:00
Emmanuel Fleury
2767e1614d Convert tests/gobject/references.c to glib test framework 2022-05-26 19:13:19 +01:00
Emmanuel Fleury
662d8458f5 Convert tests/gobject/override.c to glib test framework 2022-05-26 19:13:19 +01:00
Emmanuel Fleury
17ddf79e1d Convert tests/gobject/dynamictype.c to glib test framework 2022-05-26 19:13:16 +01:00
Emmanuel Fleury
b61d3edc33 Convert tests/gobject/defaultiface.c to glib test framework 2022-05-26 19:12:15 +01:00
Philip Withnall
d1cb96b5e3 Merge branch 'refcount_tests' into 'main'
Moving tests/refcount/ directory to gobject/tests/

See merge request GNOME/glib!2553
2022-05-26 18:03:00 +00:00
Emmanuel Fleury
d378108b10 Convert tests/gobject/accumulator.c to glib test framework 2022-05-26 18:51:57 +01:00
Philip Withnall
ed84b8f468 tests: Port GObject tests from g_thread_create() to g_thread_new()
To avoid warnings about deprecated functions.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1434
2022-05-26 18:37:35 +01:00
Emmanuel Fleury
70401ae8c3 Moving tests/refcount/ directory to gobject/tests/
Modified by Philip Withnall to omit the subdirectory and drop the
`refcount` suite as both seem like unnecessary over-categorisation.

Related to issue #1434
2022-05-26 18:37:35 +01:00
Emmanuel Fleury
b65260abe4 Convert tests/refcount/signals.c to glib test framework 2022-05-26 18:37:35 +01:00
Emmanuel Fleury
d97c1a148e Convert tests/refcount/properties4.c to glib test framework 2022-05-26 18:37:35 +01:00
Emmanuel Fleury
94ef5ae4c7 Convert tests/refcount/properties3.c to glib test framework 2022-05-26 18:37:35 +01:00
Emmanuel Fleury
ddadb89d7c Convert tests/refcount/properties2.c to glib test framework 2022-05-26 18:37:35 +01:00
Emmanuel Fleury
76fccc78c0 Convert tests/refcount/properties.c to glib test framework 2022-05-26 18:37:34 +01:00
Emmanuel Fleury
715ff4ea29 Convert tests/refcount/objects2.c to glib test framework 2022-05-26 18:37:34 +01:00
Emmanuel Fleury
62b5fe5991 Convert tests/refcount/objects.c to glib test framework 2022-05-26 18:37:34 +01:00
Philip Withnall
ce585ba4d2 Merge branch 'slice-test' into 'main'
Slice test

See merge request GNOME/glib!2579
2022-05-26 17:01:52 +00:00
Philip Withnall
8625d8144b Merge branch 'module_tests' into 'main'
Move tests/module-test.c to gmodules/tests/

See merge request GNOME/glib!2660
2022-05-26 16:42:02 +00:00
Philip Withnall
0dca8bb6aa tests: Remove redundant meson commands
The `tests` array is now empty, so everything to do with it can be
removed from this file.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-26 17:27:03 +01:00
Emmanuel Fleury
c71d0c53b5 Move tests/module-test.c to gmodules/tests/
Helps issue #1434
2022-05-26 17:26:58 +01:00
Emmanuel Fleury
f62be5660d Convert tests/modules-test.c to glib test framework 2022-05-26 16:32:48 +01:00
Philip Withnall
a20a432100 Merge branch 'nacho/uwp-warnings' into 'main'
win32appinfo: change log level from warning to debug

Closes #2640

See merge request GNOME/glib!2661
2022-05-26 14:29:11 +00:00
Matthias Clasen
694e91c130 Merge branch 'gobject-speedups3' into 'main'
gobject: Keep a count of construct params

See merge request GNOME/glib!2690
2022-05-26 14:07:26 +00:00
Matthias Clasen
ecc641de71 Avoid malloc for construct params
Stack-allocate the GObjectConstructParams (except for
extreme cases), for a small speedup of object construction.
2022-05-26 09:47:23 -04:00
Matthias Clasen
f7119a7935 Keep a count of construct params
This avoids walking the construct params list
one extra time just to count when constructing
objects, for a small speedup of object construction
in the presence of construct params.
2022-05-26 09:47:23 -04:00
Philip Withnall
4af76e2d9b Merge branch 'junit' into 'main'
gitlab-ci: left-over from junit cleanup

See merge request GNOME/glib!2687
2022-05-26 13:36:31 +00:00
Philip Withnall
eacb41f62e Merge branch 'meson-dependency-lookups' into 'main'
meson: use builtin dependency lookups for zlib/intl

See merge request GNOME/glib!2685
2022-05-26 12:57:20 +00:00