Commit Graph

18652 Commits

Author SHA1 Message Date
Emmanuele Bassi
4248b4b300 Fix the implementation of interned refstrings
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.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
501a8e96e8 Add missing copyright notice 2018-07-09 10:11:42 +01:00
Emmanuele Bassi
61ca2e4c85 Check for overflow when allocating RcBox
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.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
7c4ac58938 Allow NULL clear function when releasing references
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.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
68304ae583 Improve docs for g_rc_box/g_atomic_rc_box
Especially the preconditions and the annotations for the returned
values.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
3bc0499eb2 Rename g_arc_box to g_atomic_rc_box
Makes the API more self-explanatory.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
32ecb86f5b Add length accessor for GRefString
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.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
43b7a8f158 Add size accessor to RcBox and ArcBox
It may be useful to know how big a reference counted allocation is
outside of internal checks.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
00a723f597 Add reference counted strings
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.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
4b33b03dd3 Improve the RcBox and ArcBox documentation
Use better examples, split up into sections, and mention use with
g_autoptr().
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
8990c3c4d3 Make g_rc_box_dup()/g_arc_box_dup() more generic
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.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
b607927a43 Add atomically refcounted data
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.
2018-07-09 10:11:42 +01:00
Emmanuele Bassi
c5d2417d07 Add refcounted data
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.
2018-07-09 10:11:42 +01:00
Philip Withnall
884c4f4eb6 ci: Add allow_failure: true to FreeBSD runner
The FreeBSD runner is not stable yet. See
https://gitlab.gnome.org/Infrastructure/GitLab/issues/286.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-07-09 09:53:33 +01:00
Daniel Mustieles
419d4e610d Updated Spanish translation 2018-07-09 08:49:29 +02:00
Philip Withnall
f9589218dc Merge branch 'pcre-meson-dependency' into 'master'
meson: Add libpcre dependency version, as in configure.ac

See merge request GNOME/glib!155
2018-07-08 18:43:39 +00:00
Philip Withnall
6fea3289db Merge branch 'wip/lantw/ci-on-freebsd' into 'master'
Fix tests and add CI for FreeBSD

See merge request GNOME/glib!57
2018-07-08 18:41:30 +00:00
Philip Withnall
4256d99c3d meson: Add libpcre dependency version, as in configure.ac
Prompted by https://gitlab.gnome.org/GNOME/glib/merge_requests/148.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-08 14:34:53 +01:00
Philip Withnall
ddf03f64a4 Merge branch 'gresource-autocleanup' into 'master'
gio: Add missing autocleanup definition for GResource

Closes #1435

See merge request GNOME/glib!156
2018-07-08 10:41:25 +00:00
Adrian Perez de Castro
657be4f5fc
gio: Add missing autocleanup definition for GResource
Fixes #1435
2018-07-07 19:44:19 +03:00
Emin Tufan Çetin
17d86afa01 Update Turkish translation 2018-07-07 07:33:08 +00:00
Philip Withnall
3e74d587cf tests: Mark refcount/properties2 test as slow
It often takes a bit more than 30s to run on my local machine.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-06 15:01:58 +01:00
Philip Withnall
6438e2c731 tests: Mark gdbus-threading test as slow
It often takes a bit more than 30s on my local machine to run.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-06 15:01:40 +01:00
Philip Withnall
b1e0f09e7d tests: Add missing unit test to GLib tests list
It must have been accidentally omitted during the Meson port.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-06 14:58:57 +01:00
Philip Withnall
5422838e8d tests: Move two tests from GIO uninstalled helpers to test cases list
These are built and run as tests in the autotools build, and use GTest.
They are tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-06 14:58:25 +01:00
Philip Withnall
d31270e24c Merge branch 'pcre-8.31' into 'master'
regex: Require PCRE 8.31

See merge request GNOME/glib!148
2018-07-06 13:02:43 +00:00
Emmanuele Bassi
950b589b92 Merge branch '1332-drop-perl-dependency' into 'master'
build: Drop Perl dependency on autotools

Closes #1332

See merge request GNOME/glib!153
2018-07-06 12:59:14 +00:00
Philip Withnall
7c8aaa7e0d Merge branch 'ci-coverage-include-baseline' into 'master'
CI: Include coverage data of code which isn't executed by the test suite.

See merge request GNOME/glib!152
2018-07-06 12:28:52 +00:00
Philip Withnall
fde68be4b7 Merge branch 'meson-doc-ci' into 'master'
ci: Fix dist-job missing gobject/gio documentation

See merge request GNOME/glib!123
2018-07-06 12:22:24 +00:00
Philip Withnall
21f7566923 build: Drop Perl dependency on autotools
We don’t have the same dependency in the Meson build, and we don’t
depend on Perl any more. See #1332. The last remaining Perl script,
gen-unicode-tables.pl, is only ever run manually when we update our
Unicode character database. It will be ported to Python in due course.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1332
2018-07-06 13:07:10 +01:00
Christoph Reiter
69ae2f4242 CI: Include coverage data of code which isn't executed by the test suite.
See comment in !151. Using the "--initial" option of lcov we collect
the coverage of all compiled files and merge them later into the final
report. This way we can see which files are built but never executed
by the test suite.

Because the --initial switch also collects files in the ccache directory
we have to point it to the build directory instead, which in turn breaks
--no-external. Instead of using --no-external in the collection step,
filter out any files not in the source tree in the final coverage job
through a path filter.
2018-07-06 09:36:01 +02:00
Philip Withnall
cfc26b5a41 tests: Rework slow test handling for GIO tests
Make it follow the same pattern as in glib/tests/meson.build, using a
slow_tests array.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-05 17:14:53 +01:00
Philip Withnall
cf4f6d4808 tests: Ensure GIO tests which need dbus-daemon are run
The tests array was being wiped out by an assignment instead of an
append. This adds another 19 tests to what’s typically being run
already.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-05 13:26:48 +01:00
Philip Withnall
eeb5015ebe build: Make actions and gdbus-export GIO tests as slow
Increase their timeout.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-05 13:26:48 +01:00
Philip Withnall
a0cebdf4b6 tests: Use Unicode typography in gdbus-export test
This was missed in !137 because some of the GIO tests weren’t being run
under Meson (see following commits).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-05 13:14:22 +01:00
Stef Walter
92a01e2280 gdbus-connection-loss: Fix leak in test
https://gitlab.gnome.org/GNOME/glib/issues/786
2018-07-05 13:13:59 +01:00
Philip Withnall
ab87af1734 gresource: Fix potential array overflow if using empty paths
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
2018-07-05 12:03:10 +01:00
Philip Withnall
f62d7c1e2a gresource: Fix wrapping of function return type
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-05 11:19:20 +01:00
Xavier Claessens
c5321810f4 Merge branch '1432-reentrant' into 'master'
Resolve "Meson: Do we need -D_REENTRANT ?"

Closes #1432

See merge request GNOME/glib!149
2018-07-04 15:41:08 +00:00
Xavier Claessens
814d6a5956 Meson: Remove FIXME about _REENTRANT
As per discussion in GLib and Meson issues, this flag is not needed
anymore with modern gcc/clang. We only support GCC on Solaris now. This
might break the Sun/Oracle compilers on Solaris but Meson does not
suppor them (yet) anyway.

https://gitlab.gnome.org/GNOME/glib/issues/1432
https://github.com/mesonbuild/meson/issues/3810
2018-07-04 10:34:35 -04:00
Xavier Claessens
ed8c74461f ci: Install meson 0.47.0 on Windows envs 2018-07-03 16:01:55 -04:00
Xavier Claessens
deccba2807 Meson: Use subdir_done() now that it has been fixed 2018-07-03 11:06:48 -04:00
Xavier Claessens
95fa229f34 Meson: Fix warnings introduced in 0.47.0 2018-07-03 11:00:54 -04:00
Xavier Claessens
543a9c4f33 ci: Fix dist-job missing gobject/gio documentation
This requires meson >= 0.47.0 otherwise building the doc fails:
https://github.com/mesonbuild/meson/issues/3379

While at it, no need to to pass --prefix --libdir to meson, other CIs
don't have them.
2018-07-03 11:00:54 -04:00
Xavier Claessens
9d73ea8975 ci: Update meson to 0.47.0 in docker image 2018-07-03 11:00:54 -04:00
Olivier Blin
25b23978e1 regex: Require PCRE 8.31
PCRE >= 8.31 is required for PCRE_INFO_MAXLOOKBEHIND usage, introduced
in commit 6fbb146342 (2013/07).

regex can also make use of the PCRE_NO_AUTO_POSSESS feature from PCRE
8.34, but this is optional and properly guarded already.
2018-07-02 16:29:46 +02:00
Daniel Șerbănescu
6ee43d69fe Update Romanian translation 2018-07-01 15:06:57 +00:00
Xavier Claessens
2a1404ac21 Merge branch '977-checksum-constants' into 'master'
gchecksum: Use G_GUINT64_CONSTANT for SHA-512 constants

Closes #977

See merge request GNOME/glib!146
2018-06-29 20:17:55 +00:00
Philip Withnall
9470aa2cb9 gchecksum: Use G_GUINT64_CONSTANT for SHA-512 constants
They’re all 8 bytes long, and integer constants that large need a suffix
on 32-bit platforms.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/977
2018-06-29 18:26:00 +01:00
Philip Withnall
b0be2cdbdd Merge branch 'master' into 'master'
gspawn: treat all negative fds as unset

See merge request GNOME/glib!145
2018-06-29 17:14:37 +00:00