summaryrefslogtreecommitdiff
path: root/lib/utils/mu-utils.cc
AgeCommit message (Collapse)Author
2026-04-10lib/utils: small cleanupsDirk-Jan C. Binnema
Fix some static analysis warnings
2026-01-29mu-utils: replace #define with constexpr for MU_COLOR_Dirk-Jan C. Binnema
2025-08-24utils: add set_thread_nameDirk-Jan C. Binnema
With HAVE_PTHREAD_SETNAME_NP
2024-08-26lib: use time_t_max for empty datetimeMatthew Smith
In Mu::parse_date_time, when provided with an empty string, return time_t_max instead of G_MAXINT64. For systems with a 64-bit time_t, there is no difference. With a 32-bit time_t it caused a test to fail: not ok /utils/date-basic - ERROR:../mu-1.12.4/lib/utils/tests/test-utils.cc:92 void test_date_basic(): assertion failed (parse_date_time(std::get<0>(test), std::get<1>(test)).value_or(-1) == std::get<2>(test)): (18446744073709551615 == 2147483647) This edge case probably only affected the test, as when other parts of the application call parse_date_time (e.g. mu-server.cc and mu-query-processor.cc), they check if the input string is empty first.
2024-04-13mu-utils: update casting from int64_t -> time_tDirk-Jan C. Binnema
Esp. for systems with 32-bit time_t.
2023-09-17utils: add utf8_wordbreakDirk-Jan C. Binnema
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-09utils: handle "unbroken" scriptsDirk-Jan C. Binnema
Do not removing combining characters from scripts without explicit word boundaries, such as those for CJK. Reuse some Xapian code for that.
2023-08-21mu-utils: support UTC in parse_date_timeDirk-Jan C. Binnema
Parsing dates known to be in UTC.
2023-08-19remove Mu::format, use mu_formatDirk-Jan C. Binnema
Use the new fmt-based formatting.
2023-08-06utils: replace time_to_string with fmt-based formattingDirk-Jan C. Binnema
It's faster; make "mu find" ~5-10% faster, and removes some code we no longer need.
2023-07-06fmt: more update to use new fmt-based APIsDirk-Jan C. Binnema
2023-07-05update to use fmt-based apisDirk-Jan C. Binnema
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-01-14utils: get rid of mu-util.[ch]Dirk-Jan C. Binnema
It was getting old... Remove the unused parts, refactor the few parts still in use.
2022-12-30many: use Mu::Regex instead of std::regexDirk-Jan C. Binnema
The former is PCRE-compatible, and faster than std::regex.
2022-12-10mu-utils: use const char* from for time_to_stringDirk-Jan C. Binnema
To avoid lifetime problems with some(?) compilers.
2022-11-16lib: remove mu-runtimeDirk-Jan C. Binnema
Remove runtime; update the logger for that, and move the runtime-paths stuff to utils.
2022-08-11tests: update test helpers and usersDirk-Jan C. Binnema
Move test-mu-common to mu-test-utils. Use mu_test_init as a wrapper for g_test_init. Update users.
2022-06-18build: fix some compiler warningsDirk-Jan C. Binnema
2022-06-16utils: add regex-splitDirk-Jan C. Binnema
2022-06-04utils: improve locale_workaroundDirk-Jan C. Binnema
Fixes: #2270.
2022-06-02lib: improve test coverageDirk-Jan C. Binnema
Add a bunch of tests
2022-05-28utils: add fallback for time_to_stringDirk-Jan C. Binnema
Still don't understand issue #2230
2022-05-24utils: avoid compiler warningDirk-Jan C. Binnema
2022-05-19lib: remove some dead code (mu-str/utils)Dirk-Jan C. Binnema
Remove unused library code; recycle some electrons.
2022-05-18utils: fix unsetting timezoneDirk-Jan C. Binnema
2022-05-18tests: skip missing timezones in queries, tooDirk-Jan C. Binnema
2022-05-17utils: add locale_workaroundDirk-Jan C. Binnema
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-04-30utils: update date/size parsing, factor out formatDirk-Jan C. Binnema
And update tests
2022-04-30lib/tests: rework in terms of Mu::MessageDirk-Jan C. Binnema
2022-04-18mu-utils: avoid compiler warningDirk-Jan C. Binnema
2022-04-18option: rename to to_string_opt and to_string_view_optDirk-Jan C. Binnema
to_option_string -> to_string_opt to_string_view -> to_string_view_opt
2022-04-16utils: add extra check for #2230Dirk-Jan C. Binnema
2022-04-14utils: include unistd.hDirk-Jan C. Binnema
2022-04-14utils: add TempDir RAII classDirk-Jan C. Binnema
For tests
2022-03-26utils: add some handy STL conveniencesDirk-Jan C. Binnema
2022-03-19utils: improve split / joinDirk-Jan C. Binnema
2022-03-07utils: Handle failing g_date_time_new_...Dirk-Jan C. Binnema
Possibly, this caused a crashed under some scenarios (though couldn't reproduce).
2022-02-22utils: rework Mu::splitDirk-Jan C. Binnema
And add some tests, cleanups.
2022-02-21utils: improve assert_equal macroDirk-Jan C. Binnema
make it a macro so we get line numbers etc
2022-02-06mu-utils: try g_autoptr/g_autofreeDirk-Jan C. Binnema
It's useful, but let's if it works for all targets.
2022-02-06utils: validate string before g_utf8_next_char()Zero King
2022-01-14mu-utils: Fix compiler warningDirk-Jan C. Binnema
2021-11-10utils: add Mu::time_to_stringDirk-Jan C. Binnema
Helper function to format strings (a-la strftime).
2021-11-02mu: remove some unneeded codeDirk-Jan C. Binnema
Dead code, and replace mu_canonicalize_filename with g_canonicalize_filename.
2021-10-20clang-format: update c/cc coding styleDirk-Jan C. Binnema
Update all cc code using .clang-format; please do so as well for future PRs etc.; emacs has a handy 'clang-format' mode to make this automatic. For comparing old changes with git blame, we can disregard this one using --ignore-rev (see https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame )
2021-04-22seperate Mu::format and Mu::vformatDerek Zhou
2021-03-16utils: cleanup whitespaceDirk-Jan C. Binnema
2021-03-16utils: Add remove_ctrlDirk-Jan C. Binnema
Add a helper function to remove control characters / multi-spaces, and a test.
2020-06-27utils: Add Mu::canonicalize_filenameDirk-Jan C. Binnema
We need it for unit-tests
2020-06-13mu: convert command-line tools to c++Dirk-Jan C. Binnema