Commit Graph

2683 Commits

Author SHA1 Message Date
Emmanuel Fleury
2e4524cd36 Add the G_OPTION_ENTRY_NULL macro to properly initialize GOptionEntry arrays 2021-05-13 12:57:06 +02:00
Geyslan G. Bem
8cc03f8cd8 docs: Standardize spelling of serializ*
Changes serialis* to serializ* as proposed in #2399.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-07 08:51:22 -03:00
Robin Verdenal-Tallieux
514c2d8197 gmacros: Add __ to noinline to prevent conflict with macro in pixman
Fixes: #2388
2021-05-03 09:37:00 +00:00
Marco Trevisan (Treviño)
fbb198f968 gpattern: Move match and match_string functions into GPatternSpec
This allows introspection to properly handle them as GPatternSpec
methods, as per this deprecate g_pattern_match() and
g_pattern_match_string() functions.
2021-04-27 16:25:09 +02:00
Marco Trevisan (Treviño)
b8a9f4b436 boxed: Register GPatternSpec as boxed type 2021-04-27 16:25:09 +02:00
Marco Trevisan (Treviño)
474ece6d61 gpattern: Implement copy function
Add copy ability for pattern spec, so that it can be used as a boxed
type.
2021-04-27 16:25:09 +02:00
Aleksandr Mezin
2b9bf7b162 gmacros.h: use g_macro__has_attribute() where possible
Fall back to compiler version checks only when `__has_attribute()` is not
available.

clang-cl doesn't define `__GNU__`, but still accepts attributes. This change
gets rid of a lot of warnings when building GLib with clang-cl. For GCC and
non-cl Clang nothing should change.
2021-04-16 14:45:03 +06:00
Chun-wei Fan
35154a3519 glib-sections.txt: Add g_macro__has_extension in private section
This should satisfy the documentation build check.
2021-03-31 10:50:27 +08:00
Abanoub Ghadban
240cc7da97 gfileinfo: Add APIs to get and set {access,creation}_date_time 2021-03-28 23:07:39 +02:00
liuyangming
8fb3101715 gtree: Make g_tree_remove_all() public
g_tree_remove_all is useful and the corresponding function in GHashTable
is exposed, so make this function public is meaningful.
2021-03-23 11:36:57 +00:00
Simon McVittie
6c5a227bcc gmain: Add g_steal_fd() to API
This is basically glnx_steal_fd() from libglnx. We already had two
private implementations of it in GLib.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-22 11:48:10 +00:00
Simon McVittie
1248b642ad gversionmacros: Add version macros for GLib 2.70
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-18 13:58:41 +00:00
Philip Withnall
b31f3f5f80 gspawn: Add new g_spawn_async_with_pipes_and_fds() API
This is a simple wrapper around the new source/target FD mapping
functionality in `fork_exec()`.

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

Helps: #2097
2021-02-16 13:44:00 +00:00
Joshua Lee
c576a4cd82 string: Add find and replace function
This adds g_string_replace(), a function that replaces instances of one string
with another in a GString. It allows the caller to specify the maximum number
of replacements to perform, and returns the number of replacements performed
to the caller.

Fixes: #225
2021-02-09 10:50:16 +00:00
Philip Withnall
f8cf0b8672 gstrfuncs: Add g_memdup2() function
This will replace the existing `g_memdup()` function, which has an
unavoidable security flaw of taking its `byte_size` argument as a
`guint` rather than as a `gsize`. Most callers will expect it to be a
`gsize`, and may pass in large values which could silently be truncated,
resulting in an undersize allocation compared to what the caller
expects.

This could lead to a classic buffer overflow vulnerability for many
callers of `g_memdup()`.

`g_memdup2()`, in comparison, takes its `byte_size` as a `gsize`.

Spotted by Kevin Backhouse of GHSL.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: GHSL-2021-045
Helps: #2319
2021-02-04 14:13:03 +00:00
Xavier Claessens
4273c43902 glib_typeof: It is an API break that should be opt-in
That changes the return type of functions like g_object_ref() that can
break C++ applications like Webkit. Note that it is not an ABI break.

It must thus be opt-in the same way we did when adding this to
g_object_ref() for GNU C compilers in the first place. Unfortunately it
cannot be done directly in gmacros.h because GLIB_VERSION_2_68 is not
defined there, and gversionmacros.h cannot be included there because
there is some strict ordering in which those headers must be included.

This means that applications that does not define
GLIB_VERSION_MIN_REQUIRED will still get an API break, so we encourage
them to declare their minimum requirement to avoir such issues in the
future too.
2021-01-27 09:26:39 -05:00
Jonas Ådahl
657d18fdbb gtestutils: Add g_test_get_path() API
I found myself wanting to know the test that is currently being run,
where e.g. __func__ would be inconvenient to use, because e.g. the place
the string was needed was not in the test case function. Using __func__
also relies on the test function itself containing the whole path, while
loosing the "/" information that is part of the test path.
2021-01-25 16:34:12 +01:00
Philip Withnall
3791add329 Merge branch 'feature/glib-debug-build-option' into 'master'
build: Add glib_debug option

See merge request GNOME/glib!1889
2021-01-20 19:01:43 +00:00
Ole André Vadla Ravnås
670b84ca30 build: Add glib_debug option
To allow disabling debug infrastructure in builds with debug symbols.
2021-01-20 16:05:36 +01:00
MARTINSONS Frederic
47355c358d Add g_dbus_utils_object_path_escape and g_dbus_utils_object_path_unescape
These two APIs are useful to publish an object which path content is not
controlled (e.g. dynamically built or coming from external source).

Closes #968

(Rebased and tweaked by Frederic Martinsons)

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-20 13:23:24 +00:00
Philip Withnall
bff359dde6 docs: Add documentation for GLIB_VERSION_CUR_STABLE and PREV_STABLE
It was missing. Oh no!

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-19 15:52:29 +00:00
Philip Withnall
ba414ee100 giomodule: Ignore GIO_MODULE_DIR when running as setuid
Even if the modules in the given directory never get chosen to be used,
loading arbitrary code from a user-provided directory is not safe when
running as setuid, as the process’ environment comes from an untrusted
source.

Also ignore `GIO_EXTRA_MODULES`.

Spotted by Simon McVittie.

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

Fixes: #2168
2021-01-07 15:02:24 +00:00
Philip Withnall
8a5cc02142 Merge branch 'extended-error' into 'master'
Extended error

See merge request GNOME/glib!1304
2021-01-06 16:02:27 +00:00
Krzesimir Nowak
ae72f9de35 gerror: Add support for extended errors
This commit adds a G_DEFINE_EXTENDED_ERROR macro and
g_error_domain_register() functions to register extended error
domains.
2021-01-06 15:44:59 +00:00
Philip Withnall
9716a26ab6 Merge branch '1281-to-pixdata-docs' into 'master'
gresource: Document the `to-pixdata` option as being deprecated

Closes #1281

See merge request GNOME/glib!1826
2021-01-04 12:58:42 +00:00
Philip Withnall
0c85348efc Merge branch 'appinfo-shellany-uwplaunch' into 'master'
GWin32AppInfo: support getting info about UWP apps and launching them

Closes #1991

See merge request GNOME/glib!1772
2021-01-04 12:55:58 +00:00
Philip Withnall
37ec6f1da7 docs: Ignore new win32 private headers
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-23 01:43:37 +00:00
Philip Withnall
b63e9889a8 gresource: Document the to-pixdata option as being deprecated
Just embed a PNG instead. gdk-pixbuf deprecated its pixdata support in
version 2.32, in 2015.

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

Fixes: #1281
2020-12-22 18:42:05 +00:00
Philip Withnall
e7f9ae61dc docs: Mention GInitiallyUnowned when introducing refcounts
For completeness.

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

Fixes: #1568
2020-12-12 18:47:00 +00:00
Ondrej Holy
aa1e91e838 Merge branch '2098-add-gio-restore-support' into 'master'
Add restore option for trash gio-tool subcommand

Closes #2098

See merge request GNOME/glib!1778
2020-12-09 12:40:59 +00:00
Ondrej Holy
0458ad893a Merge branch '54-add-gio-launch-command' into 'master'
Add gio launch command to execute desktop file

Closes #54

See merge request GNOME/glib!1779
2020-12-09 12:36:41 +00:00
Frederic Martinsons
c3a073e96f Add gio launch command to execute desktop file
This command will try to execute a desktop file, before that
it will load the input as a keyfile for checking its existence
and its validity (as a keyfile).
File arguments are allowed after the desktop file.

Closes #54

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-12-09 08:15:42 +01:00
Frederic Martinsons
725984fe8e gio-tool-trash: Add --restore subcommand
It search for attribute trash::orig-path and move the input file to it.
Possibly recreating the directory of orignal path and/or overwritting
the destination.

Closes #2098

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-12-07 17:18:51 +01:00
Frederic Martinsons
105e06cc2e gio-tool-trash: Add --list subcommand
This will print all the files in TrashCan along with their
original location.

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-12-07 17:15:43 +01:00
Philip Withnall
5e1d368eec Merge branch 'binding-threadsafe-2' into 'master'
Make GBinding thread-safe (alternative approach)

See merge request GNOME/glib!1745
2020-12-04 14:23:10 +00:00
Sebastian Dröge
c8c829fa42 Add g_binding_dup_target() and g_binding_dup_source()
These new getters prevent the source/target from simply disappearing if
they're finalized from another thread in the meantime.
2020-11-26 10:49:23 +02:00
Emmanuel Fleury
c1d74e35c1 Adding macros G_NORETURN and G_NORETURN_FUNCPTR
This macro is borrowed from the gnulib project in the 'noreturn.h' file.

Fixes: #994
2020-11-25 11:34:05 +00:00
Sebastian Dröge
72360eb8bd Merge branch '553-tz-errors' into 'master'
gtimezone: Add new constructor which can report errors

Closes #553

See merge request GNOME/glib!1760
2020-11-22 08:35:33 +00:00
Sebastian Dröge
fa8a39c6c6 Merge branch 'py-fixes' into 'master'
Python formatting improvements

See merge request GNOME/glib!1757
2020-11-20 18:10:40 +00:00
Philip Withnall
fab561f8d0 gobject: Drop use of volatile from get_type() macros
http://isvolatileusefulwiththreads.in/c/

It’s possible that the variables here are only marked as volatile
because they’re arguments to `g_once_*()`. Those arguments will be
modified in a subsequent commit.

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

Helps: #600
2020-11-20 14:40:19 +00:00
Philip Withnall
c33de0dc5f docs: Clarify the meaning of --buildtype=plain a little
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1833
2020-11-18 13:29:11 +00:00
Philip Withnall
8105c36e84 gtimezone: Add new constructor which can report errors
Add a new variant of `g_time_zone_new()` which returns `NULL` on
failure to load a timezone, rather than silently returning UTC.

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

Fixes: #553
2020-11-18 11:31:15 +00:00
Philip Withnall
d270b6c3db py: Various flake8 cleanups
None of these are particularly significant, but they do get the CI
output clean.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-17 15:50:07 +00:00
Philip Withnall
905b22a17e py: Reformat all Python files consistently
This commit is the unmodified results of running
```
black $(git ls-files '*.py')
```
with black version 19.10b0. See #2046.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-17 15:50:07 +00:00
Niels De Graef
f98f2c5d0f gtestutils: Add g_assert_cmpstrv()
Add a test util function that helps asserting two string arrays are the
same, and which adds some useful information if they're not.

Fixes: #2015
2020-11-14 18:17:19 +00:00
Sebastian Dröge
ddef9ba2f8 Merge branch 'instantiatable' into 'master'
gobject: Standardise on the term ‘instantiatable’

See merge request GNOME/glib!1735
2020-11-13 15:29:07 +00:00
Norbert Pocs
a879c46a39 gdbus: Add FD support for gdbus call
Gdbus call could not take file handle (parameter 'h') as a parameter.

Original patch from Tim Waugh <twaugh@redhat.com>.

Fixes: #961
2020-11-06 17:19:27 +00:00
Benjamin Otte
98f0a5a7da gtype: Add g_type_interface_instantiatable_prerequisite()
This function returns the most specific instantiatable type
that is a prerequisite for a given interface.

This type is necessary in particular when dealing with GValues
because a GValue contains an instance of a type.

This commit includes tests for the new API.
2020-11-02 17:36:18 +00:00
Philip Withnall
4f2b1e250d gobject: Standardise on the term ‘instantiatable’
Rather than using a mixture of ‘instantiable’ and ‘instantiatable’
everywhere, standardise on the term which is already in the public API.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-02 17:22:01 +00:00
Philip Withnall
86b910e6b1 Merge branch 'issue-2236' into 'master'
Include generated files and documentation in the GIO reference

Closes #2236

See merge request GNOME/glib!1730
2020-11-02 11:45:26 +00:00
Emmanuele Bassi
e1744603d8 Build gdbus-objectmanager-example docs unconditionally
The GIO reference documentation links to that documentation, so we
cannot only build it when the installed tests are enabled.
2020-10-30 16:42:53 +00:00
Emmanuele Bassi
2993bb8275 docs: Fix xinclude directives
For legacy reasons, Meson's gtk-doc helper script launches the
gtkdoc-mkhtml tool in the `html` directory under the build root. This
means that all paths must be relative to that location.
2020-10-30 16:41:07 +00:00
Emmanuele Bassi
db2cb16e20 docs: Add missing annotation glossary
Without the glossary, gtk-doc will emit warnings for every introspection
annotation it finds.
2020-10-30 16:39:10 +00:00
Philip Withnall
159a9c215a gio: Fix various typos of the name ‘D-Bus’
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-26 14:28:15 +00:00
Philip Withnall
e2e8339e0a Merge branch 'typeof' into 'master'
Use C++11 decltype where possible

See merge request GNOME/glib!1575
2020-10-15 08:52:47 +00:00
Xavier Claessens
5b2bee3f53 Replace __typeof__ with glib_typeof macro
g_has_typeof macro is wrongly in the public g_ namespace, internaly
symbols are usually in the glib_ namespace. This will also allow to
define glib_typeof differently on non-GNUC compilers (e.g. c++11
decltype).
2020-10-14 14:48:36 -04:00
Robert Ancell
b2cc8d1740 gstrvbuilder: Add a new object to make NULL-terminated string arrays.
GLib uses NULL-terminated string arrays (GStrv) in a number of places, however
these are quite hard to construct in C when the number of elements is not known
in advance. GStrvBuilder wraps GPtrArray to make these easy to create with
type safety and does the memory management for you.
2020-10-14 11:01:24 +00:00
Sergio Costas
c12762a091 GSubprocessLauncher: allow to close passed FDs
By default, when using g_subprocess_launcher_take_fd() to pass an
FD to a child, the GSubprocessLauncher object also takes ownership
of the FD in the parent, and closes it during finalize(). This is
a reasonable assumption in the majority of the cases, but sometimes
it isn't a good idea.

An example is when creating a GSubprocessLauncher in JavaScript:
here, the destruction process is managed by the Garbage Collector,
which means that those sockets will remain opened for some time
after all the references to the object has been droped. This means
that it could be not possible to detect when the child has closed
that same FD, because in order to make that work, both FDs
instances (the one in the parent and the one in the children) must
be closed. This can be a problem in, as an example, a process that
launches a child that communicates with Wayland using an specific
socket (like when using the new API MetaWaylandClient).

Of course, it isn't a valid solution to manually call close() in
the parent process just after the call to spawn(), because the FD
number could be reused in the time between it is manually closed,
and when the object is destroyed and closes again that FD. If that
happens, it will close an incorrect FD.

One solution could be to call run_dispose() from Javascript on the
GSubprocessLauncher object, to force freeing the resources.
Unfortunately, the current code frees them in the finalize()
method, not in dispose() (this is fixed in !1670 (merged) ) but it
isn't a very elegant solution.

This proposal adds a new method, g_subprocess_launcher_close(),
that allows to close the FDs passed to the child. To avoid problems,
after closing an FD with this method, no more spawns are allowed.

Fix: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1677
2020-10-12 20:29:48 +02:00
Simon McVittie
b17b537a7d gmessages: Expose our default filtering as API
This allows programs that want to change how log messages are printed,
such as gnome-terminal (gnome-terminal#42) and Flatpak, to override
the log-writer or the legacy log-handler without having to reimplement
the G_MESSAGES_DEBUG filtering logic.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-07 14:04:08 +01:00
Simon McVittie
10b0ece9d8 gmessages: Add API to move info and debug messages to stderr
GLib code normally prints info and debug messages to stdout,
but that interferes with programs that are documented to produce
machine-readable output such as JSON or XML on stdout. In particular,
if such a program uses a GLib-based library, setting G_MESSAGES_DEBUG
will typically result in that library's debug messages going to the
program's stdout and corrupting the machine-readable output.

Unix programs can avoid this by using dup2() to move the original stdout
to another fd, then dup2() again to make the new stdout a copy of stderr,
but it's easier if we provide a way to not write debug messages to
stdout in the first place. Calling
g_log_writer_default_set_use_stderr (TRUE) results in behaviour
resembling Python's logging.basicConfig(), with all diagnostics going
to stderr.

Suggested by Allison Karlitskaya on glib#2087.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-07 14:03:50 +01:00
Andrew Potter
3dc62171eb Add boxing for GTree
Closes issue #1233
2020-10-07 11:00:11 +01:00
Philip Withnall
7bfd6278b9 Merge branch 'gtree-add-iterators' into 'master'
GTree: add an ability to iterate over a tree and a node-based API

See merge request GNOME/glib!1509
2020-10-06 13:43:18 +00:00
Maciej S. Szmigiero
2e7931c760 GTree: add an ability to iterate over a tree and a node-based API
The basic API that this commit adds allows in-order iterating over a GTree.

For this the following API were implemented or exported:
1) Returning the first or the last node in the tree,

2) Taking a pointer to a node in the tree and returning the previous or the
next in-order node,

3) Allowing to do a binary search for a particular key value and returning
the pointer to its node,

4) Returning the newly inserted or set node from both insert and replace
functions, so this node is immediately available and does not have to be
looked up,

5) Traversing the tree in-order providing a node pointer to the
caller-provided traversal function.

Most of the above functions were already present in the code, but they
returned the value that is stored at a particular node instead of the
pointer to the node itself.

So most of the code for these new API calls is shared with these existing
ones, just adapted to return the pointer to the node.

Additionally, the so called "lower bound" and "upper bound" operations
were implemented.

The first one returns the first element that is greater than or equal to
the searched key, while the second returns the first element that is
strictly greater than the searched key.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
2020-10-06 11:07:11 +01:00
Maxim Mikityanskiy
094eca7076 gio: Expose g_file_build_attribute_list_for_copy
Expose a function that prepares an attribute query string to be passed
to g_file_query_info() to get a list of attributes normally copied with
the file. This function is used by the implementation of
g_file_copy_attributes, and it's useful if one needs to split
g_file_copy_attributes into two stages, for example, when nautilus does
a recursive move of a directory. When files are moved from the source
directory, its modification time changes. To preserve the mtime on the
destination directory, it has to be queried before moving files and set
after doing it, hence these two stages.

Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
2020-10-06 10:16:49 +01:00
Patrick Griffis
f9fc29f0b7 gtlscertificate: Add support for PKCS #11 backed certificates
This reverts commit d58e5de9e9.
2020-10-01 17:09:04 +01:00
Simon McVittie
d65c8c30a9 GDBus: Add G_DBUS_METHOD_INVOCATION_HANDLED, _UNHANDLED
Like G_SOURCE_REMOVE and G_SOURCE_CONTINUE, these make it clearer what
it means to return TRUE or FALSE.

In particular, in GDBus methods that fail, the failure case still needs
to return TRUE (unlike the typical GError pattern), leading to comments
like this:

    g_dbus_method_invocation_return_error (invocation, ...);
    return TRUE;    /* handled */

which can now be replaced by:

    g_dbus_method_invocation_return_error (invocation, ...);
    return G_DUS_METHOD_INVOCATION_HANDLED;

G_DBUS_METHOD_INVOCATION_UNHANDLED is added for symmetry, but is very
rarely (perhaps never?) useful in practice.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 16:32:50 +01:00
Philip Withnall
c51a8ce8c8 gversionmacros: Add version macros for GLib 2.68
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-01 14:33:21 +01:00
Philip Withnall
bb1df0e515 Merge branch 'uri-params-iter' into 'master'
Add GUriParamsIter

See merge request GNOME/glib!1572
2020-08-05 16:07:42 +00:00
Ondrej Holy
0d6b17584a gunixmounts: Add g_unix_mount_point_at
There is already g_unix_mount_at function which allows to find certain
unix mount for given mount path. It would be useful to have similar
function for mount points, which will allow to replace custom codes in
gvfs. Let's add g_unix_mount_point_at.
2020-08-05 13:07:04 +01:00
Marc-André Lureau
5767eef895 uri: add GUriParamsIter
See also:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1328#note_863735
2020-08-04 20:10:57 +04:00
Philip Withnall
b79747eee1 Merge branch 'remove-broken-xp-code' into 'master'
gio: Remove broken support for XP

See merge request GNOME/glib!1583
2020-07-27 02:07:43 +00:00
Philip Withnall
554107c23c gfileutils: Add g_file_set_contents_full() and GFileSetContentsFlags
This is a new version of the g_file_set_contents() API which will allow
its safety to be controlled by some flags, allowing the user to choose
their preferred tradeoff between safety (`fsync()` calls) and speed.

Currently, the flags do nothing and the new API behaves like the old
API. This will change in the following commits.

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

Helps: #1302
2020-07-26 21:37:46 +01:00
Nirbheek Chauhan
4e485d76ac gio: Remove broken support for XP
We now require Windows 7 or newer, and the networking code hasn't
worked in a long time since we directly use symbols from iphlapi.dll
now.
2020-07-26 21:30:05 +05:30
Philip Withnall
735c80dc5b Merge branch 'uri-parse-params' into 'master'
A few g_uri_parse_params() improvements

See merge request GNOME/glib!1557
2020-07-08 10:53:11 +00:00
Marc-André Lureau
591d8676ee uri: modify g_uri_parse_params() to take flags
This will allow to further enhance the parsing, without breaking API,
and also makes argument on call side a bit clearer than just TRUE/FALSE.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-07-07 15:16:22 +04:00
Philip Withnall
fa13c41da7 gtrace: Add sysprof tracing support infrastructure
Add some internal wrappers around sysprof tracing, so that it can be
used throughout GLib without exposing all the details of sysprof
internally.

This adds an optional dependency on `libsysprof-capture-4`. sysprof
support is disabled without it.

This depends on the GLib dependency of `libsysprof-capture` being
dropped in https://gitlab.gnome.org/GNOME/sysprof/-/merge_requests/30,
which has bumped the soname of `libsysprof-capture` and added subproject
support.

The next few commits will add marks that trace out each `GMainContext`
iteration and each `GSource` `check`/`prepare`/`dispatch` call.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-07 11:17:10 +01:00
Ruslan Marchenko
44524b9daa Add g_(d)tls_connection_get_channel_binding_data calls and enums
* Add g_tls_connection_get_channel_binding_data API call
 * Add g_dtls_connection_get_channel_binding_data API call
 * Add get_binding_data method to GTlsConnection class
 * Add get_binding_data method to GDtlsConnection interface
 * Add GTlsChannelBindingType enum with tls-unique and
   tls-server-end-point types
 * Add GTlsChannelBindingError enum and G_TLS_CHANNEL_BINDING_ERROR
   quark
 * Add new API calls to documentation reference gio-sections-common
2020-06-25 12:40:34 +00:00
Dan Winship
d83d68d64c guri: new URI parsing and generating functions
Add a set of new URI parsing and generating functions, including a new
parsed-URI type GUri. Move all the code from gurifuncs.c into guri.c,
reimplementing some of those functions (and
g_string_append_uri_encoded()) in terms of the new code.

Fixes:
https://gitlab.gnome.org/GNOME/glib/issues/110

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-06-25 13:57:35 +04:00
Philip Withnall
00bfb3ab44 tree: Fix various typos and outdated terminology
This was mostly machine generated with the following command:
```
codespell \
    --builtin clear,rare,usage \
    --skip './po/*' --skip './.git/*' --skip './NEWS*' \
    --write-changes .
```
using the latest git version of `codespell` as per [these
instructions](https://github.com/codespell-project/codespell#user-content-updating).

Then I manually checked each change using `git add -p`, made a few
manual fixups and dropped a load of incorrect changes.

There are still some outdated or loaded terms used in GLib, mostly to do
with git branch terminology. They will need to be changed later as part
of a wider migration of git terminology.

If I’ve missed anything, please file an issue!

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-12 15:01:08 +01:00
Emmanuele Bassi
3d0e1f5c85 Merge branch '1931-bookmark-file-y2038' into 'master'
Resolve "GBookmarkFile API involves time_t"

Closes #1931

See merge request GNOME/glib!1511
2020-05-28 15:41:04 +00:00
Philip Withnall
fbc1456971 gbookmarkfile: Add Y2038-proof APIs to GBookmarkFile
These are alternatives to the existing `time_t`-based APIs, which will
soon be deprecated due to `time_t` only being Y2038-safe on 64-bit
systems.

The new APIs take a GDateTime instead.

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

Helps: #1931
2020-05-28 14:55:53 +01:00
Chun-wei Fan
cd229a2fb4 docs: Document --symbol-decorator for gdbus-codegen
This updates gdbus-codegen.xml to include documentation for the
--symbol-decorator, --symbol-decorator-header and
--symbol-decorator-define options, which is used to help to export
symbols in the generated code.
2020-05-28 18:24:57 +08:00
Philip Withnall
60dd272b6a docs: Bump gtk-doc requirement for unit tests to 1.32.1
gtk-doc 1.33 hasn’t been released yet, but when it is, it’ll contain
three fixes which are necessary for correctly detecting which symbols
are undocumented/undeclared/unused in GLib:
 • gtk-doc@b866a90b
 • gtk-doc@ca42972c
 • gtk-doc@b922e148

1.32.1 is the development version number which will eventually be
released as 1.33.

Until then, we can’t run the gtk-doc tests in CI because they reliably
fail spuriously. See !1488.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-22 09:57:33 +01:00
Philip Withnall
9f421dd678 docs: Add indexes for symbols added in 2.66
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-20 12:20:28 +01:00
Edward Hervey
1a95ce84ed GValue: Add interned string support
This adds support to be able to explicitely stored interned strings into
G_TYPE_STRING GValue.

This is useful for cases where the user:
* *knows* the string to be stored in the GValue is canonical
* Wants to know whther the string stored is canonical

This allows:
* zero-cost GValue copy (the content is guaranteed to be unique and exist
  throughout the process life)
* zero-cost string equality checks (if both string GValue are interned, you just
  need to check the pointers for equality or not, instead of doing a strcmp).

Fixes #2109
2020-05-19 17:52:55 +02:00
Philip Withnall
0fc7f409f6 Revert "Revert "glib: annotate static inline functions with G_AVAILABLE-type macros""
This reverts commit c0146be3a4.

The revert was originally added because the original change broke
gnome-build-meta. Now that the problem has been diagnosed, the original
commit can be fixed — see the commit which follows this one.

See: !1487
2020-05-15 11:59:06 +01:00
Philip Withnall
85f8efae0f Merge branch 'aleksm/mkenums-since' into 'master'
glib-mkenums: allow optional 'since' tag

See merge request GNOME/glib!1492
2020-05-14 16:10:33 +00:00
Philip Withnall
01fbeb601b Merge branch 'assert-no-errno' into 'master'
gtestutils: Add a new g_assert_no_errno() test macro

See merge request GNOME/glib!1204
2020-05-14 16:09:40 +00:00
Aleksander Morgado
ec6056e3ab glib-mkenums: allow optional 'since' tag
The glib-mkenums program allows generating code to handle enums/flags
with very different purposes. One of its purposes could be generating
per-enum/flag methods to be exposed in a library API, and while doing
that, it would be nice to have a way to specify in which API version
the enum/flag was introduced, so that the same version could be shown
in the generated API methods.

E.g. From the following code:

    /**
     * QmiWmsMessageProtocol:
     * @QMI_WMS_MESSAGE_PROTOCOL_CDMA: CDMA.
     * @QMI_WMS_MESSAGE_PROTOCOL_WCDMA: WCDMA.
     *
     * Type of message protocol.
     *
     * Since: 1.0
     */
    typedef enum { /*< since=1.0 >*/
        QMI_WMS_MESSAGE_PROTOCOL_CDMA  = 0x00,
        QMI_WMS_MESSAGE_PROTOCOL_WCDMA = 0x01
    } QmiWmsMessageProtocol;

The template would allow us to generate a method documented like this,
including the Since tag with the value given in the mkenums 'since' tag.

    /**
     * qmi_wms_message_protocol_get_string:
     * @val: a QmiWmsMessageProtocol.
     *
     * Gets the nickname string for the #QmiWmsMessageProtocol specified at @val.
     *
     * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
     * Since: 1.0
     */
    const gchar *qmi_wms_message_protocol_get_string (QmiWmsMessageProtocol val);

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-14 17:00:54 +02:00
Aleksander Morgado
4d1132a945 docs,glib-mkenums: setup lists for enum/value trigraph extensions
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-14 17:00:46 +02:00
Michael Catanzaro
c0146be3a4 Revert "glib: annotate static inline functions with G_AVAILABLE-type macros"
This reverts commit 5050298749
2020-05-12 21:28:52 +00:00
Simon Marchi
5050298749 glib: annotate static inline functions with G_AVAILABLE-type macros
The public functions exposed as static inlines currently don't have
annotations to describe when they were introduced.  This means that
compiling this file:

    #include <glib.h>

    void foo (void)
    {
      g_rec_mutex_locker_new (NULL);
    }

with:

    gcc -c test.c \
      -I/tmp/glib/include/glib-2.0 \
      -I/tmp/glib/lib/x86_64-linux-gnu/glib-2.0/include \
      -Werror \
      -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28 \
      -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28

will not produce any error message, despite using
`g_rec_mutex_locker_new`, a function that was introduced after 2.28.

This patch adds some annotations to all the publicly exposed static
inline functions I could find.

I could not use the existing G_AVAILABLE* macros, because they may
expand to `extern`.  This would then clash with the `static` keyword and
produce:

    ../glib/gthread.h:397:1: error: multiple storage classes in declaration specifiers
      397 | static inline GRecMutexLocker *
          | ^~~~~~

So I opted for adding a new set of macros,
GLIB_AVAILABLE_STATIC_INLINE_IN_2_XY.

With this patch applied, the example from above produces the expected
warning:

    test.c: In function ‘foo’:
    test.c:5:3: error: ‘g_rec_mutex_locker_new’ is deprecated: Not available before 2.60 [-Werror=deprecated-declarations]
        5 |   g_rec_mutex_locker_new (NULL);
          |   ^~~~~~~~~~~~~~~~~~~~~~
    In file included from /tmp/glib/include/glib-2.0/glib/gasyncqueue.h:32,
                     from /tmp/glib/include/glib-2.0/glib.h:32,
                     from test.c:1:
    /tmp/glib/include/glib-2.0/glib/gthread.h:398:1: note: declared here
      398 | g_rec_mutex_locker_new (GRecMutex *rec_mutex)
          | ^~~~~~~~~~~~~~~~~~~~~~
2020-05-12 12:42:50 +01:00
Xavier Claessens
be3728b9fa Meson: Add glib_checks and glib_asserts options
In cases where performance are critical it can be useful to disable
checks and asserts. GStreamer has those options too, using the same name
and setting them yielding means we can set those options on the main
project (e.g. gst-build) and glib will inherit the same value when built
as subproject.
2020-04-09 09:17:35 -04:00
Ondrej Holy
5737d064f9 docs: Mention new gio tool options
New features were added for gio tool, but they are not mentioned in
man pages as it is not generated from GOptionEntry in contrast to the
help output. Let's update the man pages to reflect the recent changes.
2020-04-02 13:23:09 +02:00
Chris Mayo
84ad802c3a docs: Fix configuration with gtk_doc=true and installed_tests=false
Skip the gdbus-object-manager-example which is generated as part of
testing.

Program xsltproc found: YES (/usr/bin/xsltproc)
Run-time dependency gtk-doc found: YES 1.32

docs/reference/gio/gdbus-object-manager-example/meson.build:1:0: ERROR:
Unknown variable "libgdbus_example_objectmanager_dep".
2020-03-27 19:33:12 +00:00
Philip Withnall
9e45b95816 gtestutils: Add a new g_assert_no_errno() test macro
This is for use in testing POSIX-style functions like `rmdir()`, which
return an integer < 0 on failure, and return their error information in
`errno`.

The new macro prints `errno` and `g_strerror (errno)` on failure.

Includes a unit test.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-04 15:32:25 +00:00
Jehan
13d1697b67 gobject: Add g_{param_spec,signal}_is_valid_name() functions
Making this validation code public allows projects to validate a
GParamSpec name before creating it. While hard-coded GParamSpec don't
need this, we can't afford crashing the main program for dynamically
generated GParamSpec from user-created data.

In such case, we will need to validate the param names and return errors
instead of trying to create a GParamSpec with invalid names.

Includes modifications from Philip Withnall and Emmanuele Bassi to
rearrange the new function addition and split it into one function for
GParamSpecs and one for GSignals.
2020-03-04 14:46:28 +00:00
Philip Withnall
fb1e416a32 gversionmacros: Add version macros for GLib 2.66
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-04 14:46:28 +00:00
Nirbheek Chauhan
3732f9bd07 docs: Document generated headers caveats for genmarshal
And also link to the Meson FAQ that explains why this is needed so
people aren't just cargo-culting code.
2020-02-25 03:14:50 +05:30
Emmanuele Bassi
653e0f0813 Add links to Meson docs for genmarshal and mkenums 2020-02-24 16:14:33 +00:00
Emmanuele Bassi
83c13e52d5 docs: Mention Meson's gnome.mkenums_simple()
The mkenums_simple() function generates idiomatic GObject code, and
avoids templates and custom command line arguments.
2020-02-24 16:14:33 +00:00
Emmanuele Bassi
79cdd531d0 Add example of using glib-genmarshal with Meson
We're using Meson for GLib itself, and we recommend people to use it
for their own projects, so it would be good to have our documentation
present examples on how to use Meson with our tools.
2020-02-24 16:14:33 +00:00
Emmanuele Bassi
040803b34d Add example of using glib-mkenums with Meson
We're using Meson for GLib itself, and we recommend people to use it
for their own projects, so it would be good to have our documentation
present examples on how to use Meson with our tools.

Let's move the template example into its own section while we're at it,
since it's referenced by both Meson and Autotools examples.

Fixes: #1783
2020-02-24 15:46:35 +00:00
Emmanuele Bassi
15a4cf4d3f Ensure that we use @basename@ in the glib-mkenums docs
The documentation for @filename@ is not accurate either.
2020-02-24 15:08:49 +00:00
Philip Withnall
760c8ccbe6 docs: Don’t install object manager example separately
The relevant parts of the generated example documentation are already
`xi:include`d into the `migrating-gdbus.xml` page, so are turned into
HTML there. Installing them separately means they also get installed
into `/usr/share/gtk-doc/html/gdbus-object-manager-example/`, which
seems redundant.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-11 11:47:03 +00:00
Philip Withnall
a0e74a8c47 Merge branch '1993-codegen-version-args' into 'master'
Rename gdbus-codegen --glib-min-version argument to --glib-min-required and add --glib-max-allowed

Closes #1993

See merge request GNOME/glib!1342
2020-01-31 13:49:20 +00:00
Philip Withnall
e855e30d6d Merge branch 'gtkdoc-check-fix' into 'master'
Various fixes to make gtkdoc-check pass on glib

See merge request GNOME/glib!978
2020-01-31 13:23:42 +00:00
Philip Withnall
c07d9434f4 Merge branch 'wip/oholy/gfile-docs' into 'master'
Symlink-related fixes for `g_file_move()`

Closes #986

See merge request GNOME/glib!900
2020-01-31 12:56:15 +00:00
Michael Catanzaro
d58e5de9e9 Revert "gtlscertificate: Add support for PKCS #11 backed certificates"
This reverts commit b6d8efbebc.

This GLib API is good, but the implentation is not ready, so there's no
reason to commit to the API in GLib 2.64. We can reland again when the
implementation is ready.

There are three problems: (a) The glib-networking implementation normally
works, but the test has been broken for a long time. I'm not comfortable
with adding a major new feature without a working test. This is
glib-networking#104. (b) The WebKit implementation never landed. There
is a working patch, but it hasn't been accepted upstream yet. This API
isn't needed in GLib until WebKit is ready to start using it.
https://bugs.webkit.org/show_bug.cgi?id=200805. (c) Similarly, even if
the WebKit API was ready, that itself isn't useful until an application
is ready to start using it, and the Epiphany level work never happened.

Let's try again for GLib 2.66. Reverting this commit now just means we
gain another six months before committing to the API forever. No reason
to keep this in GLib 2.64 when nothing is using it yet.
2020-01-30 04:19:22 -06:00
Xavier Claessens
5bd78907a7 doc: Add gtk-doc subproject fallback
Now that we require Meson 0.52 to build the doc, we can also pull
gtk-doc as subproject when missing from the system. This requires
to pull gtk-doc master because needed changes there haven't been release
yet.
2020-01-29 15:54:53 +01:00
Xavier Claessens
ed0e06097c doc: Requires Meson >=0.52.0 to build documentation 2020-01-29 15:54:53 +01:00
Xavier Claessens
09d995286b doc: Run gtkdoc-check with unit tests
This has the side effect of always rebuilding the doc at each build when
gtk_doc option is enabled (not by default). Most importantly, this will
enable doc check on our CI.
2020-01-29 15:54:53 +01:00
Xavier Claessens
74bb6c98cb doc: add missing indexes 2020-01-29 15:54:53 +01:00
Xavier Claessens
6e8a7c2cd4 doc: Add back gdbus-object-manager-example
This requires Meson 0.52.0 for the return value of gnome.gtkdoc().
2020-01-29 15:40:17 +01:00
Xavier Claessens
6d05ac2fa9 Revert "docs: remove GDBusObjectManager example"
This reverts commit 398c048c66.

It got removed because it used to cause build issues, but now that we
have a CI let's hope it won't be a problem any more.
2020-01-29 15:40:17 +01:00
Nelson Benítez León
fc1e2bc9f0 docs: tag enclose 'all' and 'help' values
so they are not confused as being normal text.

Seen at:
https://developer.gnome.org/glib/stable/glib-running.html
2020-01-29 12:11:24 +00:00
Philip Withnall
9734e4854e gdbus-codegen: Add --glib-max-allowed argument
This complements the `--glib-min-required` argument, just like the
`GLIB_MIN_REQUIRED` and `GLIB_MAX_ALLOWED` preprocessor defines which
control access to APIs in C.

Currently, it doesn’t affect code generation at all. When we next change
code generation, we will need to gate any new API usage on this
argument.

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

Fixes: #1993
2020-01-27 10:42:26 +00:00
Philip Withnall
4d1c3e15f9 gdbus-codegen: Rename --glib-min-version to --glib-min-required
This makes it consistent with the `GLIB_MIN_REQUIRED` defines which are
used for API stability/versioning in C code.

It doesn’t otherwise change the behaviour of the `--glib-min-version`
argument.

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

Helps: #1993
2020-01-27 10:11:46 +00:00
Marc-André Lureau
fd61a21ecd Add and use G_SIZEOF_MEMBER() macro
A convenient macro present in the Linux kernel, named FIELD_SIZE() there.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-01-21 19:54:55 +04:00
wouter bolsterlee
809a9210c3 Support multiple directories in GSETTINGS_SCHEMA_DIR
This adds support for specifying multiple directories in the
GSETTINGS_SCHEMA_DIR environment variable by separating the values
using G_SEARCHPATH_SEPARATOR_S (colon on UNIX-like systems).

While programs could already register multiple custom GSettings schema
directories, it was not possible to achieve the same without writing
custom code, e.g. when using the gsettings command line tool.

Fixes #1998.
2020-01-16 10:20:34 +00:00
Matthew Leeds
2a605f6e15 gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).

If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).

So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.

The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46

It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.

Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.

Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.

The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.

Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2020-01-15 09:37:41 -08:00
Philip Withnall
eda096243b docs: Add g_source_set_dispose_function() to documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-16 13:57:28 +00:00
Philip Withnall
467b4d6789 docs: Update GMemoryMonitor listings in docs
Fix a few things missed in code review.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-16 13:57:28 +00:00
Emmanuele Bassi
4ad429c7ca Merge branch 'revert-1277-i-got-it-wrong' into 'master'
Revert "Revert "docs: remove GDBusObjectManager example""

See merge request GNOME/glib!1282
2019-12-16 12:37:34 +00:00
Emmanuele Bassi
f9bbee7db2 Merge branch '1726-codegen-glib-min-version' into 'master'
gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/ min-version

Closes #1726

See merge request GNOME/glib!1263
2019-12-12 12:49:34 +00:00
Philip Withnall
df8745fabc Revert "Revert "docs: remove GDBusObjectManager example""
This reverts commit df4fb2cd32.

It needed to be coupled with the other commit from !978, and introduces
breakage into the documentation when compiled by itself. My mistake for
not testing properly.

See discussion on https://gitlab.gnome.org/GNOME/glib/merge_requests/1277#note_666761
2019-12-12 11:30:36 +00:00
Philip Withnall
fcc1367383 Merge branch 'gtkdoc-check-fix' into 'master'
Various gtk-doc improvements

See merge request GNOME/glib!1277
2019-12-11 13:02:20 +00:00
Xavier Claessens
df4fb2cd32 Revert "docs: remove GDBusObjectManager example"
This reverts commit 398c048c66.

It got removed because it used to cause build issues, but now that we
have a CI let's hope it won't be a problem any more.
2019-12-11 12:16:27 +00:00
Bastien Nocera
cd6612dfb7 gio: Add GMemoryMonitor to monitor for low-memory
Add a memory monitor object, with D-Bus and Portal based
implementations. The D-Bus implementation uses the Linux-only
low-memory-monitor Freedesktop project.

Low Memory Monitor D-Bus API:
https://hadess.pages.freedesktop.org/low-memory-monitor/

Android API:
https://developer.android.com/reference/android/content/ComponentCallbacks2.html#onTrimMemory(int)

iOS API:
https://developer.apple.com/documentation/uikit/app_and_environment/managing_your_app_s_life_cycle/responding_to_memory_warnings

Win32 API:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.win32.systemevents.lowmemory?view=netframework-4.8

Tizen API:
https://samsung.github.io/TizenFX/master/api/Tizen.Applications.EventManager.SystemEvents.LowMemory.html
2019-12-11 11:44:42 +00:00
Philip Withnall
90f0733858 gdbus-codegen: Add a --glib-min-version argument
This can be used by callers to opt-in to backwards-incompatible changes
to the behaviour or output of `gdbus-codegen` in future. This commit
doesn’t introduce any such changes, though.

Documentation and unit tests included.

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

Helps: #1726
2019-12-11 10:40:07 +00:00
Philip Withnall
b698327b99 Merge branch 'cherry-pick-6ea0dcc6' into 'master'
doc: Add missing --ignore-decorators

Closes #1953

See merge request GNOME/glib!1260
2019-12-03 12:48:37 +00:00
Xavier Claessens
160143ae27 gtk-doc: Ensure we have recent enough version
Older versions won't produce errors, but will silently miss
documentation for a few symbols.
2019-12-01 08:25:04 -05:00
Xavier Claessens
7b65b77a65 doc: Add missing --ignore-decorators
(cherry picked from commit 6ea0dcc6c9af0c0e8cfebc77412838f5174b7dbc)
2019-11-29 18:43:10 +00:00
Emmanuele Bassi
cc3716a943 Merge branch 'thread-safe-getpwnam' into 'master'
glocalvfs: Use thread-safe getpwnam_r() rather than getpwnam()

Closes #1687

See merge request GNOME/glib!681
2019-11-27 11:58:51 +00:00
Philip Withnall
34cb297a86 Merge branch 'wip/nielsdg/g-list-store-find' into 'master'
gliststore: Add item lookup functions

Closes #1011

See merge request GNOME/glib!1096
2019-11-27 11:22:56 +00:00
Philip Withnall
94a800fb9d glib-unix: Add g_unix_get_passwd_entry() function
This is a convenience wrapper around getpwnam_r() which handles all the
memory allocation faff.

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

Helps: #1687
2019-11-26 12:17:04 +00:00
Ernestas Kulik
58ba7d78fb list, slist: Add g_clear_{s,}list()
Although not quite as often-occurring, this should help with constructs
like this:

  if (list)
    {
      g_list_free_full (list, foo);
      list = NULL;
    }

Closes https://gitlab.gnome.org/GNOME/glib/issues/1943
2019-11-25 13:09:25 +01:00
Garrett Regier
6cac760551 task: Add return/propagate API for GValue
This is useful for bindings.

Related: https://gitlab.gnome.org/GNOME/glib/issues/668
2019-11-15 10:37:42 +00:00
Simon McVittie
81936ca580 Make ld executable configurable
Tools like this should be configurable in a cross or native file. In
particular, if we are cross-compiling (with an executable wrapper like
qemu-arm), the build system ld is not necessarily able to manipulate
host system objects.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-04 15:08:33 +00:00
Simon McVittie
61f693fb21 Merge branch '1916-objcopy-cross-compilation' into 'master'
tests: Use objcopy from the cross-compilation file, if configured

Closes #1916

See merge request GNOME/glib!1188
2019-10-28 20:06:50 +00:00
Philip Withnall
c73bd53eb8 Merge branch 'fbsd_build' into 'master'
Update documentation with FreeBSD build instructions

See merge request GNOME/glib!1120
2019-10-28 17:26:26 +00:00
Philip Withnall
57aaee76d5 docs: Add objcopy to example cross-compilation file
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1916
2019-10-28 12:11:12 +00:00
Philip Withnall
21f8f89820 gmain: Add GMainContextPusher convenience API
This is like `GMutexLocker`, in that if you are able to use
`g_autoptr()`, it makes popping a `GMainContext` off the thread-default
main context stack easier when exiting a function.

A few uses of `G_GNUC_{BEGIN,END}_IGNORE_DEPRECATIONS` are needed to
avoid warnings when building apps against GLib with
`GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-23 11:35:58 +01:00
Philip Withnall
0869cdedcf Merge branch '1858-tutorial-deprecated-gobject-api' into 'master'
Fix handling of private object members in GObject property tutorial

Closes #1858

See merge request GNOME/glib!1069
2019-10-10 13:15:39 +00:00
Jonas Ådahl
15e3b6f136 gmessages: Add g_warning_once()
In many places the pattern

    static gboolean warned_once = FALSE;
    if (!warned_once)
      {
        g_warning ("This and that");
        warned_once = TRUE;
      }

is used to not spam the same warning message over and over again. Add a
helper in glib for this, allowing the above statement to be changed to

    g_warning_once ("This and that");
2019-10-09 16:39:31 +02:00
Philip Withnall
45c91d7ed6 Merge branch 'g-os-info' into 'master'
gutils: Add g_get_os_info()

See merge request GNOME/glib!1063
2019-10-08 10:30:24 +00:00
Paolo Bonzini
7bada8394d Add g_array_steal(), g_ptr_array_steal() and g_byte_array_steal()
Closes issue #285
2019-10-07 14:38:24 +02:00
Philip Withnall
d207e19d32 Merge branch 'wip/tingping/pkcs11' into 'master'
gtlscertificate: Add pkcs11-uri property and constructor

Closes #1809

See merge request GNOME/glib!933
2019-10-03 12:12:16 +00:00
Patrick Griffis
b6d8efbebc gtlscertificate: Add support for PKCS #11 backed certificates
This adds properties to allow backends to expose PKCS #11 support.
2019-10-02 10:12:40 -07:00
rim
4d362a5afe Update documentation with FreeBSD build instructions 2019-09-30 23:06:53 +03:00