Peter Hutterer
6563b66a92
utils: add strv_find()
...
Finds and optionally returns the index of a string in a strv
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1193 >
2025-04-24 17:34:06 +10:00
Peter Hutterer
63a8ad2ead
util: add some extra strv helpers
...
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1178 >
2025-04-04 22:19:47 +00:00
Peter Hutterer
051ac26a20
util: shut up clang-tidy about our use of strcat
...
These are pre-counted strings, we're fine.
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175 >
2025-04-04 15:47:23 +00:00
Peter Hutterer
ea7ad8d25c
util: add a strv_for_each helper function
...
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1038 >
2024-09-05 13:54:07 +00:00
Peter Hutterer
35a237e24c
Fix a few gcc analyzer complaints in util-strings.*
...
Sprinkle a few asserts into the various string helpers for where our
arguments must not be NULL.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-19 14:19:08 +10:00
Peter Hutterer
a5dd45e8ce
Remove duplicate empty lines in our source
...
We only touch src and tools, imported headers from include are not ours
to change.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
Peter Hutterer
d2f6773831
Remove a few empty lines with nothing but a lonely tab
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
Peter Hutterer
703ecb200c
Remove trailing whitespaces in the tree
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
Yinon Burgansky
eeae8906db
util: return the number of elements from strv_from_string
...
Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
2022-11-07 22:32:24 +02:00
luokai
87447a0ee9
using secure functions safe_strdup
...
Signed-off-by: luokai <l18674732394.com>
2021-06-15 11:27:29 +08:00
Peter Hutterer
7f4df04d59
tools/record: deduplicate the device opening logic
...
With a new helper function strv_from_argv we can re-use the device opening
loop for all the use-cases we have.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-30 08:26:30 +10:00
Peter Hutterer
671eb8cbbb
utils: add a safe version of basename
...
So we don't need to worry about the libgen.h include game.
And we can switch trunkname over to that, making it a bit simpler.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-23 10:56:53 +10:00
Peter Hutterer
e6ed506df3
utils: add a trunkname() function to extract the trunk of a filename
...
/path/to/foo.bar returns "foo"
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-12 14:31:50 +10:00
Torstein Husebø
18c9265224
treewide: fix typos
...
Signed-off-by: Torstein Husebø <torstein@huseboe.net>
2020-12-16 22:08:23 +01:00
Peter Hutterer
a1a419df6c
util: fix a scan-build warning (value set but not read)
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 10:43:52 +10:00
Peter Hutterer
c84366e85e
Split utility functions into separate source files
...
libinput-util.h is getting a bit of a catchall bucket and it includes things
like libinput-private.h which in turn includes libwacom. This makes
libinput-util.h less useful for bits that only need e.g. the string processing
utilities.
So let's split them all up in to separate files, to be used as-needed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:23:04 +10:00