Commit Graph

18 Commits

Author SHA1 Message Date
088408c085 sysprof-capture-condition: always return even if unreachable
Fix the problem with -Werror=return-type
2020-09-15 20:51:28 +07:00
cef698e658 libsysprof-capture: wrap strdup to be NULL-safe 2020-07-03 22:00:34 +01:00
607af73676 libsysprof-capture: Stop defining G_LOG_DOMAIN
libsysprof-capture no longer calls any of the GLib logging functions
which make use of it.

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

Helps: #40
2020-07-03 22:00:34 +01:00
e26eae5bcf libsysprof-capture: Use libc string functions rather than GLib ones
Use `strcmp()` and `strdup()` rather than `g_strcmp0()` and
`g_strdup()`. In the latter case, this makes no difference. In the
former case it means we potentially need to do some additional `NULL`
checks before calling it; although most of the call sites use
fixed-length arrays, so no `NULL` check is needed.

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

Helps: #40
2020-07-03 22:00:34 +01:00
1d865c5c8e libsysprof-capture: Use sysprof_{steal,clear}_pointer() instead of GLib
They work exactly the same way as the GLib functions.

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

Helps: #40
2020-07-03 22:00:34 +01:00
e96e35b6f1 libsysprof-capture: Stop using GArray in SysprofCaptureCondition
The code is well-suited to directly using `calloc()` instead, since the
arrays never grow dynamically.

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

Helps: #40
2020-07-03 22:00:34 +01:00
0e4b3f52b1 libsysprof-capture: Handle OOM conditions in SysprofCaptureCondition
This doesn’t change any of the sites which call
`sysprof_capture_condition_*()` in other files, but does change
`SysprofCaptureCondition` internally to handle OOM and return an error
code.

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

Helps: #40
2020-07-03 22:00:34 +01:00
b0a5c4f700 libsysprof-capture: Use malloc() rather than g_new0() and friends
Another step away from GLib. This changes the OOM behaviour of the
library — previously it would immediately `abort()` on OOM. However, it
seems likely that given the small number of allocations
libsysprof-capture does, it should be able to recover from an OOM
situation more gracefully than larger libraries can — so the new
implementation tries to do that.

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

Helps: #40
2020-07-03 22:00:34 +01:00
951b46fddf libsysprof-capture: Use intrinsic atomics rather than g_atomic_*()
Use the intrinsic atomics provided by the compiler, instead of GLib’s
wrapper around them. This should work for all modern compilers.

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

Helps: #40
2020-07-03 22:00:34 +01:00
f925fab564 libsysprof-capture: Replace G_{UN,}LIKELY with SYSPROF_{UN,}LIKELY
This does the same thing for modern compilers, but without the GLib
dependency.

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

Helps: #40
2020-07-03 22:00:34 +01:00
8e28ac6e81 libsysprof-capture: Use assert() instead of g_assert()
Also use it instead of `g_return_if_fail()`.

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

Helps: #40
2020-07-03 22:00:34 +01:00
5636bbf4f0 libsysprof-capture: Use stdbool instead of gboolean
Another step towards dropping GLib as a dependency of
libsysprof-capture.

Unlike the previous commit which replaced GLib integer types with the
bitwise equivalent C standard types, `stdbool` is potentially a different
width from `gboolean`, so this is an ABI break.

It therefore involves some changes to callback functions in the tests
and tools, and in libsysprof.

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

Helps: #40
2020-07-02 21:07:11 +01:00
2c2cbf6343 libsysprof-capture: Use C11 types instead of GLib types
This is an almost entirely mechanical* conversion from (for example)
`gint` → `int`, `guint8` → `uint8_t`, etc.

It is not entirely complete, as many GLib functions are still used in
libsysprof-capture, which necessitate some use of GLib types.

It also avoids renaming `gboolean` → `bool` as that’s a slightly more
controversial change which will happen in the following commit.

*Code was manually realigned afterwards.

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

Helps: #40
2020-07-02 21:07:11 +01:00
532972beb6 libsysprof-capture: relicense as BSD-2-Clause-Patent
This allows embedding the static capture library without having to deal
with license incompatibility while retaining the patent clause. We want
as many consumers of the format as makes sense without the restriction
of what kind of app/library/tooling they are.

The application, sysprofd, libsysprof, and libsysprof-ui continue to be
GPLv3+.
2019-06-05 13:25:21 -07:00
4cfbb9a857 libsysprof: add file frame with path condition 2019-05-29 15:13:01 -07:00
567f8a3a0f libsysprof-capture: shorten names by removing Frame 2019-05-29 15:13:01 -07:00
2e4b17be17 libsysprof-capture: add or condition 2019-05-29 15:13:00 -07:00
53c718b708 build: rename all symbols to use sysprof_ as prefix
As we gain in usage, we need to be more careful about using a prefix
that will not collide with other symbols. So version 3 of our ABI will
change to using Sysprof/SYSPROF/sysprof as the various prefixes.

The soname/api version bump will happen later on this branch so that
things are easier to test up until then.
2019-05-29 15:12:59 -07:00