---
src/functions/string.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/functions/string.c b/src/functions/string.c
index 1ff4305..5fb5f4e 100644
--- a/src/functions/string.c
+++ b/src/functions/string.c
@@ -81,6 +81,27 @@ func_to_upper(struct workspace *wk, uint32_t rcvr, uint32_t args_node, obj *res)
return true;
}
+static bool
+func_to_lower(struct workspace *wk, uint32_t rcvr, uint32_t args_node, obj *res)
+{
+ if (!interp_args(wk, args_node, NULL, NULL, NULL)) {
+ return false;
+ }
+
+ make_obj(wk, res, obj_string)->dat.str = str_clone(wk, wk, rcvr);
+
+ const struct str *ss = get_str(wk, *res);
+
+ uint32_t i;
+ for (i = 0; i < ss->len; ++i) {
+ if ('A' <= ss->s[i] && ss->s[i] <= 'Z') {
+ ((char *)ss->s)[i] += 32;
+ }
+ }
+
+ return true;
+}
+
#define MAX_KEY_LEN 64
bool
@@ -505,6 +526,7 @@ const struct func_impl_name impl_tbl_string[] = {
{ "strip", func_strip },
{ "to_int", func_string_to_int },
{ "to_upper", func_to_upper },
+ { "to_lower", func_to_lower },
{ "underscorify", func_underscorify },
{ "version_compare", func_version_compare },
{ NULL, NULL },
--
2.33.1
meson.py implements compatibility checks for this, and logs the
following warning when building muon:
WARNING: Project specifies a minimum meson_version '>=0.48.0' but uses features which were added in newer versions:
* 0.49.0: {'/ with string arguments'}
* 0.50.0: {'File argument for extract_objects'}
* 0.53.0: {'summary'}
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index b8aadff..3aff244 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
'c',
version: '0.0.1',
license: 'GPL3',
- meson_version: '>=0.48.0',
+ meson_version: '>=0.53.0',
default_options: [
'c_std=c11',
'warning_level=3',
--
2.33.1
---
tests/project/meson.build | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tests/project/meson.build b/tests/project/meson.build
index 22776ef..3f7886d 100644
--- a/tests/project/meson.build
+++ b/tests/project/meson.build
@@ -237,8 +237,7 @@ tests = [
'common/243 escape++',
]
-# this could probably be a better location
-test_dir = meson.global_build_root() / 'test-tmp'
+test_dir = meson.current_build_dir()
# HACK: mkdir before any tests run to avoid race
test('setup project tests', find_program('mkdir'), args: ['-p', test_dir / 'common'])
--
2.33.1