a03fd48551
utils: support negative lexnums
...
We use "lexnums" to efficiently/sortably store numbers >= 0; let's
support negative numbers as well (albeit not very optimal in size yet)
2026-08-20 15:05:31 -07:00
86464cd083
modernization: tweaks for c++20
...
Update various places for what we can do with C++20:
- ends_with / starts_with
- std::to_array
- using instead of typedef
- designated initializers
- "[[maybe_unused]]" instead of G_GNUC_UNUSED
Also remove some unnecessary 'static'
2026-08-20 15:05:30 -07:00
f2960a197e
utils: add ascii ctype helpers
...
Add some constexpr ctype helpers that avoid any possible UB (i.e.,
handling casting to unsigned), and explicitly avoid any
locale-specifics.
2026-08-20 15:05:30 -07:00
6715ff418a
lib/utils: small cleanups
...
Fix some static analysis warnings
2026-08-20 15:05:29 -07:00
45b9722040
mu/lib: fix some possible quoting issues
2026-08-20 15:05:28 -07:00
db7bd7a900
mu-utils: replace #define with constexpr for MU_COLOR_
2026-08-20 15:05:28 -07:00
85f4a4b80a
utils: fix typo
2026-08-20 15:05:28 -07:00
ab6017d5a9
utils: rework MU_ENABLE_BITOPS using C++20 code
...
Instead of macros, we using C++20 concepts to define the helpers to deal with
bitops on enum-class conveniently.
x# Please enter the commit message for your changes. Lines starting
2026-08-20 15:05:28 -07:00
f66b58cd41
utils: rework logging functions
...
Use a general mu_log which does the formatting, and specific mu_debug, mu_info
etc., to call it.
2026-08-20 15:04:27 -07:00
5c6642c9b9
utils: add utf8_clean helper
...
To morph text into valid utf8 if it isn't already.
2026-08-20 15:04:27 -07:00
056540b8e8
utils: avoid fmt:gmtime/fmt::localtime
...
They've been deprecated and give build warnings with new enough libfmt.
2026-08-20 15:04:26 -07:00
5378f321f4
utils: add set_thread_name
...
With HAVE_PTHREAD_SETNAME_NP
2026-08-20 15:04:25 -07:00
33958cd0f7
fmt: prefer system package if found
...
mu embeds a "vendored" subset of the libfmt package under thirdparty; but it's
better to use the system-package if the user has one.
So, use the system package if found or user -Duse-embedded-fmt=true is
specified.
2025-07-24 19:55:27 +03:00
eb75141d0a
mu_utils: add to_string_char
...
Like to_string_gchar, but for malloc/free strings.
2025-06-14 13:14:03 +03:00
646ad2e840
lib/utils: include fmt/xchar.h
...
Needed for 'join'
2024-12-06 20:14:11 +02:00
29dc1cea0c
Fix typos.
2024-09-22 17:27:18 +00:00
a6ec43a740
mu-utils: update casting from int64_t -> time_t
...
Esp. for systems with 32-bit time_t.
2024-04-13 20:06:39 +03:00
45b4f60348
mu-utils: Fix build with musl
...
In musl, `stdout` is a macro that expands to `(stdout)`, and
`::(stdout)` is not valid C++.
../mu-1.12.2/lib/utils/mu-utils.hh:268:32: error: expected
id-expression before '(' token
268 | ::stdout);
| ^~~~~~
Nothing in the Mu namespace is named stdout, so it is safe to drop
the `::`.
Bug: https://bugs.gentoo.org/928361
2024-04-01 11:23:39 +00:00
abb0fb4fd5
utils/add: improve unit test coverage
2023-09-24 17:29:56 +03:00
6ce94ce914
mu-utils: add to_string_view
2023-09-21 23:41:15 +03:00
7cbab21099
utils: add utf8_wordbreak
...
Determine if a string has wordbreaks in a mostly Xapian-compatible way.
We need this to determine what strings should be considered "phrases".
2023-09-17 18:11:10 +03:00
9c28c65d45
utils: handle "unbroken" scripts
...
Do not removing combining characters from scripts without explicit word
boundaries, such as those for CJK.
Reuse some Xapian code for that.
2023-09-09 11:40:36 +03:00
e1308a9b40
utils: small tweaks
2023-08-27 11:07:55 +03:00
c1950ae0cb
mu-utils: support UTC in parse_date_time
...
Parsing dates known to be in UTC.
2023-08-21 18:29:21 +03:00
15f08488d3
remove Mu::format, use mu_format
...
Use the new fmt-based formatting.
2023-08-19 20:04:50 +03:00
11df0bedce
utils: add mu_print[ln] for ostreams
2023-08-11 19:57:00 +03:00
27c07280b1
utils: replace time_to_string with fmt-based formatting
...
It's faster; make "mu find" ~5-10% faster, and removes some code we no
longer need.
2023-08-06 16:19:43 +03:00
56b8fad89e
utils: implement html-to-text
...
Implement a crude html-to-text scraper function, to extract plain text
from html messages, so we can use it for indexing.
2023-07-25 21:26:36 +03:00
31f0c40893
migrate to fmt-based logging in some more places
...
and improve logging.
2023-07-08 10:30:36 +03:00
82235b9d49
fmt: more update to use new fmt-based APIs
2023-07-06 21:49:50 +03:00
4920b56671
update to use fmt-based apis
...
Not complete, but a first big stab converting users of Mu::Error and
various g_warning & friends, format to the new libfmt-based APIs.
2023-07-05 23:10:13 +03:00
742ca33740
utils: rework Mu::Error and g_ logging macros with fmt
...
A bit more C++ template magic to remove a lot of code.
2023-07-05 23:07:11 +03:00
201fe45edc
server: add a few stopwatches
...
For measuring performance.
2023-01-19 22:37:50 +02:00
6979a66630
utils: get rid of mu-util.[ch]
...
It was getting old...
Remove the unused parts, refactor the few parts still in use.
2023-01-14 20:02:05 +02:00
27ecbbdd65
many: use Mu::Regex instead of std::regex
...
The former is PCRE-compatible, and faster than std::regex.
2022-12-30 11:15:03 +02:00
27ffaba817
mu-utils: use const char* from for time_to_string
...
To avoid lifetime problems with some(?) compilers.
2022-12-10 19:22:00 +02:00
64f08149bc
lib: remove mu-runtime
...
Remove runtime; update the logger for that, and move the runtime-paths
stuff to utils.
2022-11-16 23:31:51 +02:00
9e60ebb683
utils: add helpers for assoc-pairs
...
Add some unit-test, too.
2022-10-02 18:24:23 +03:00
317fe53ff7
tests: update test helpers and users
...
Move test-mu-common to mu-test-utils. Use mu_test_init as a wrapper for
g_test_init. Update users.
2022-08-11 22:55:10 +03:00
f69ad37e7a
utils: add regex-split
2022-06-16 22:49:46 +03:00
b03590cca8
tests: skip missing timezones in queries, too
2022-05-18 01:08:40 +03:00
c4cc9795dc
utils: add locale_workaround
...
Attempt to work around some locale handling throwing in some systems.
"locale::facet::_S_create_c_locale name not valid"
Ugly, but maybe it helps.
2022-05-17 22:31:03 +03:00
9e78d3d13f
utils: insist on semicolon after MU_ENABLE_BITOPS
2022-05-14 12:47:26 +03:00
b7a30c0a36
utils: update date/size parsing, factor out format
...
And update tests
2022-04-30 10:40:45 +03:00
9e9e16a7ec
lib/tests: rework in terms of Mu::Message
2022-04-30 10:40:45 +03:00
7c51bc68d4
option: rename to to_string_opt and to_string_view_opt
...
to_option_string -> to_string_opt
to_string_view -> to_string_view_opt
2022-04-18 22:04:33 +03:00
4f9c154d1a
utils: add deletable_unique_ptr
2022-04-16 16:20:38 +03:00
a7e6d57286
utils: add TempDir RAII class
...
For tests
2022-04-14 17:06:33 +03:00
dc2be0b442
utils: add seq_some
2022-03-28 22:53:05 +03:00
a23c99ff7e
utils: add some handy STL conveniences
2022-03-26 17:19:10 +02:00