diff options
author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2020-05-10 23:01:40 +0200 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2020-07-27 21:58:27 -0700 |
commit | 67c394f12c7280fe3d0125dfed7cb7ce383a949d (patch) | |
tree | fa5b9ac91d435fbbbb40bffcd6692e010d38bd8a /gi/arg-inl.h | |
parent | 7c07aa338135248c0e7ed70f76cb9030862276fc (diff) | |
download | gjs-67c394f12c7280fe3d0125dfed7cb7ce383a949d.tar.gz |
arg: Use GIArgument's char pointer to store strings
Since it's defined, better to just reuse instead of doing casts
Diffstat (limited to 'gi/arg-inl.h')
-rw-r--r-- | gi/arg-inl.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gi/arg-inl.h b/gi/arg-inl.h index aafee2bb..e1fbd6a4 100644 --- a/gi/arg-inl.h +++ b/gi/arg-inl.h @@ -103,7 +103,7 @@ GJS_USE inline decltype(auto) gjs_g_argument_value<double>(GIArgument* arg) { template <> GJS_USE inline decltype(auto) gjs_g_argument_value<char*>(GIArgument* arg) { - return gjs_g_argument_value(arg, &GIArgument::v_pointer); + return gjs_g_argument_value(arg, &GIArgument::v_string); } template <> @@ -127,6 +127,11 @@ inline void gjs_g_argument_value_set<gboolean, GI_TYPE_TAG_BOOLEAN>( gjs_g_argument_value<bool>(arg) = !!v; } +template <> +inline void gjs_g_argument_value_set(GIArgument* arg, const char* v) { + gjs_g_argument_value<char*>(arg) = const_cast<char*>(v); +} + template <typename T, GITypeTag TAG = GI_TYPE_TAG_VOID> GJS_USE inline T gjs_g_argument_value_get(GIArgument* arg) { return gjs_g_argument_value<T, TAG>(arg); |