Commit Graph

24092 Commits

Author SHA1 Message Date
Emmanuele Bassi
f62622fc7b docs: Start stanzas with a single paragraph
When rendering the contents of the GLib documentation stored inside the
introspection data, a common behaviour is to take the first paragraph as
a summary of the symbol being documented.

The documentation is assumed to be in Markdown format, which means:

 - paragraphs must be separated by newlines
 - lines that have an indentation of four or more spaces are considered
   code blocks
 - lines that start with a `#` are considered titles

This means we need to slightly tweak the documentation in our sources to
ensure that it can be rendered appropriately by tools that are not
gtk-doc.

See issue: #2365
2021-08-02 13:22:23 +01:00
Simon McVittie
b13777841f g_string_replace: Document behaviour of zero-length match pattern
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:36:26 +01:00
Philip Withnall
069308ab54 Merge branch 'issue-2429' into 'main'
gspawn: safe_fdwalk/safe_closefrom for Solaris 11.3/11.4

Closes #2429

See merge request GNOME/glib!2203
2021-08-02 11:35:55 +00:00
Simon McVittie
bf70d58d55 test_string_replace: Exercise zero-length replacements
Previously, these would have done 2**32 replacements, and the first one
would have consumed 6GB of memory in the process. They now match what
Python `str.replace()` does.

Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2452
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:31:19 +01:00
Simon McVittie
0a8c7e57ab g_string_replace: Don't replace empty string more than once per location
This matches the behaviour of Python `str.replace()`, and avoids carrying
out 2**32 replacements before n wraps around, which is almost certainly
not what we want.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2452
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:31:19 +01:00
Simon McVittie
7d35e49c42 test_string_replace: Expand test coverage
These are taken from another project (steam-runtime-tools) where I
implemented a similar replace method before realising that more recent
GLib versions had g_string_replace().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:31:19 +01:00
Simon McVittie
c64e6cfc79 test_string_replace: Make the test table-driven
This makes it straightforward to add more test-cases.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:31:19 +01:00
Simon McVittie
24b652d3ca test_string_replace: Make types agree
g_string_replace() returns guint, not gint.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 11:53:56 +01:00
Philip Withnall
ce5a2cfed5 Merge branch 'regwatch-appinfo-fixes' into 'main'
GWin32RegistryKey / GWin32AppInfo registry watch fixes

See merge request GNOME/glib!2205
2021-08-02 10:51:28 +00:00
Casper Dik
a75ffc5112 gspawn: safe_fdwalk for Solaris 11.4
Use F_NEXTFD/F_PREVFD for fdwalk when they are available.

Closes #2429
2021-08-01 12:52:34 -07:00
Casper Dik
790571a2cd gspawn: safe_closefrom for Solaris 11.3/11.4
When F_CLOSEFROM is defined, we know that closefrom() is signal safe.
2021-08-01 12:43:19 -07:00
Руслан Ижбулатов
4e9e7bfd34 GWin32AppInfo: re-trigger registry watcher from the callback
To ensure that the watch is properly re-set every time, call
watch_keys() from the watch callback. Previously the watch was only
renewed after a data update was done in a worker thread, which made
no sense, since the update function was implemented in such a way
that it can (and should) be re-triggered on each key change, until
the changes stop coming, and that can only happen if we renew
the registry watcher right away.
2021-07-31 11:01:06 +00:00
Руслан Ижбулатов
6885a29428 GWin32RegistryKey: ensure reqeueing works correctly
If a key watch is renewed from the key watch callback, it results
in the callback being NULL, since we clear it after we call it.

Rearrange the function to make sure that the changes done by the
callback function are preserved properly.
2021-07-31 10:57:44 +00:00
Руслан Ижбулатов
8c25302726 GWin32RegistryKey: Change STATUS_SUCCESS handling
This function can, in fact, return STATUS_SUCCESS. We shouldn't
assert that it doesn't.

For now interpret it just like STATUS_PENDING (i.e. APC will be called),
see how it goes (it isn't documented how the function behaves in this
case, we have to play it by ear).

Note that while we *can* use a better-documented RegNotifyChangeKeyValue() here,
it communicates back to us via event objects, which means that the registry
watcher would have to interact with the main loop directly and insert its
events (plural; one event per key) there. That would make the API more complicated.
Whereas the internal NT function communicates by calling an APC - we're good
as long as something somewhere puts the thread in alertable state.
2021-07-31 10:50:12 +00:00
Matthias Clasen
9599a9451c Add a test for Unicode normalization
This test verifies the examples from the Unicode
Annex that defines normalization.
2021-07-30 16:54:59 +01:00
Matthias Clasen
770059b588 tests: Remove a misplaced comment
This comment had nothing to do with the test below.
2021-07-29 14:19:41 -04:00
Matthias Clasen
6a6da9637a Fix a Unicode typo
The name of one of the Unicode Break types is misspelt.
Add an alias, since it annoys me every time I look at
Pango's break code.
2021-07-29 10:09:27 -04:00
Philip Withnall
02742ef957 Merge branch 'pgriffis/low-power-monitor' into 'main'
Add GPowerProfileMonitor

See merge request GNOME/glib!2194
2021-07-28 14:52:15 +00:00
Patrick Griffis
889bdb994f Add GPowerProfileMonitor 2021-07-28 15:56:02 +02:00
Bastien Nocera
92399e7114 gio: Do not block when low-memory-monitor daemon appears 2021-07-28 15:31:16 +02:00
Bastien Nocera
a7000cd989 gio: g_clear_signal_handler() can handle NULL args 2021-07-28 15:31:01 +02:00
Bastien Nocera
2e500304e3 tests: Remove unused constant in GMemoryMonitor test 2021-07-28 15:04:46 +02:00
Philip Withnall
f56fbb50a4 Merge branch 'fix-annotations' into 'main'
Fix doc stanzas for GDataInputStream properties

See merge request GNOME/glib!2200
2021-07-28 05:41:09 +00:00
Philip Withnall
6549a36535 Merge branch 'mainloop-id-rationale' into 'main'
Document the stance on ID-based mainloop APIs

See merge request GNOME/glib!2202
2021-07-27 15:50:31 +00:00
Matthias Clasen
74f9f5d47d Document the stance on ID-based mainloop APIs
This will make it easier to reject MRs like
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2199
in the future.
2021-07-27 10:21:43 -04:00
Emmanuele Bassi
4a16a5b374 Merge branch 'ebassi/final-flag' into 'main'
Add "final" type flag

Closes #2321

See merge request GNOME/glib!1937
2021-07-27 12:03:20 +00:00
Emmanuele Bassi
39d5f34442 Fix doc stanzas for GDataInputStream properties
There's no such thing as a GDataStream.
2021-07-27 12:50:03 +01:00
Emmanuele Bassi
ef15a4e720 docs: Add new symbols 2021-07-27 12:27:53 +01:00
Emmanuele Bassi
9aacb4dd6f Add unit for the "final" GType flag
Check that we're emitting the correct set of warnings when trying to
derive a final type.
2021-07-27 12:27:53 +01:00
Emmanuele Bassi
d1861c8fda Add G_DEFINE_* macros for final types
These should match the G_DECLARE_FINAL_* macros used in a header file.
2021-07-26 20:13:32 +01:00
Emmanuele Bassi
c07dd416cf gtype: Add a "final" flag
We want to have the ability to mark types that should not be derivable
even if they are in a deeply derivable type hierarchy; in other words,
leaf nodes in the types tree.
2021-07-26 20:13:32 +01:00
Philip Withnall
808cde540a Merge branch 'source-static-name' into 'main'
Port internal uses to use g_source_set_static_name()

See merge request GNOME/glib!2198
2021-07-26 15:05:50 +00:00
Philip Withnall
ef6a551739 Merge branch 'main' into 'main'
Fix some test suite memory leaks

See merge request GNOME/glib!2195
2021-07-26 10:06:08 +00:00
Philip Withnall
8e963e0e31 Port internal uses to use g_source_set_static_name()
This should reduce allocations.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-26 11:01:07 +01:00
Philip Withnall
302346d4d3 Merge branch 'cheaper-source-names' into 'main'
mainloop: Add g_source_set_static_name

See merge request GNOME/glib!2196
2021-07-26 09:45:52 +00:00
Philip Withnall
1faa5cd4d0 Merge branch 'avoid-name-collisions' into 'main'
GResource compiler: Prefix static [con|de]strutors with c_name

See merge request GNOME/glib!2197
2021-07-26 09:34:19 +00:00
Chun-wei Fan
8093da7ce6 GResource compiler: Prefix static [con|de]strutors with c_name
When attempting to test Windows support for building libadwaita, since we are
using multiple GResource files, one would hit linker errors where multiple
definitions of the following symbols have been defined, when
glib-compile-resources was invoked without manual register:

resource_constructor_wrapper
resource_destructor_constructor
_arrayresource_constructor
_arrayresource_destructor

In order to avoid that, just prefix the definitions of resource_constructor
and resource_destructor, like what we do when --manual-register is used, with
what we pass in with --c-name so that we ensure that we do not end up in such
name collisions.
2021-07-26 17:05:23 +08:00
Kukuh Syafaat
5ade56decd Update Indonesian translation 2021-07-25 14:02:17 +00:00
Alexey Rubtsov
191df3abd4 Update Russian translation 2021-07-25 07:30:23 +00:00
Matthias Clasen
bb4d390577 mainloop: Add g_source_set_static_name
g_source_set_name duplicates the string, and this is
showing up as one of the more prominent sources of strdups
in GTK profiles, despite all the names we use being literals.

Add a variant that avoids the overhead.
2021-07-24 11:26:40 -04:00
GOUJON Évan
6e46edea5b gobject/tests/param: Fix a memory leak 2021-07-23 22:21:33 +02:00
GOUJON Évan
5e356d90b2 glib/tests/spawn-path-search: Fix memory leaks 2021-07-23 22:21:28 +02:00
GOUJON Évan
dd69955e58 gio/tests/async-splice-output-stream: Fix a memory leak 2021-07-23 22:21:23 +02:00
GOUJON Évan
d129395fe2 g_system_thread_new: Free a memory leak on error path 2021-07-23 22:21:11 +02:00
GOUJON Évan
bd779c96e9 glib/gtestutils: Introduce and use a test_cleanup function 2021-07-23 22:20:54 +02:00
GOUJON Évan
353f0b5235 glib/gtestutils: Introduce and use a g_test_suite_free function 2021-07-23 22:16:44 +02:00
GOUJON Évan
f0c0d8b67c glib/gtestutils: Introduce and use a g_test_case_free function 2021-07-23 22:10:08 +02:00
GOUJON Évan
0786031804 g_test_run: Introduce a clean up path once test suite ran 2021-07-23 22:05:52 +02:00
Rafael Fontenelle
7888358150 Update Brazilian Portuguese translation 2021-07-23 15:03:08 +00:00
Philip Withnall
950bbe7984 Merge branch 'DarkTrick-main-patch-15325' into 'main'
Update GValue doc: How to use GBoxed with GValue

See merge request GNOME/glib!2179
2021-07-22 12:37:43 +00:00