stenlarsson commented on code in PR #48522:
URL: https://github.com/apache/arrow/pull/48522#discussion_r2655075461
##########
c_glib/arrow-glib/compute.cpp:
##########
@@ -7091,6 +7094,205 @@ garrow_extract_regex_options_new(void)
return GARROW_EXTRACT_REGEX_OPTIONS(options);
}
+enum {
+ PROP_REPLACE_SUBSTRING_OPTIONS_PATTERN = 1,
+ PROP_REPLACE_SUBSTRING_OPTIONS_REPLACEMENT,
+ PROP_REPLACE_SUBSTRING_OPTIONS_MAX_REPLACEMENTS,
+};
+
+typedef struct _GArrowReplaceSubstringOptionsPrivate
GArrowReplaceSubstringOptionsPrivate;
+struct _GArrowReplaceSubstringOptionsPrivate
+{
+ gchar *pattern;
+ gchar *replacement;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowReplaceSubstringOptions,
+ garrow_replace_substring_options,
+ GARROW_TYPE_FUNCTION_OPTIONS)
+
+#define GARROW_REPLACE_SUBSTRING_OPTIONS_GET_PRIVATE(object)
\
+ static_cast<GArrowReplaceSubstringOptionsPrivate *>(
\
+ garrow_replace_substring_options_get_instance_private(
\
+ GARROW_REPLACE_SUBSTRING_OPTIONS(object)))
+
+static void
+garrow_replace_substring_options_dispose(GObject *object)
+{
+ auto priv = GARROW_REPLACE_SUBSTRING_OPTIONS_GET_PRIVATE(object);
+ if (priv->pattern) {
+ g_free(priv->pattern);
+ priv->pattern = nullptr;
+ }
+ if (priv->replacement) {
+ g_free(priv->replacement);
+ priv->replacement = nullptr;
+ }
+
G_OBJECT_CLASS(garrow_replace_substring_options_parent_class)->dispose(object);
+}
+
+static void
+garrow_replace_substring_options_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ auto options =
+
garrow_replace_substring_options_get_raw(GARROW_REPLACE_SUBSTRING_OPTIONS(object));
+ auto priv = GARROW_REPLACE_SUBSTRING_OPTIONS_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_REPLACE_SUBSTRING_OPTIONS_PATTERN:
+ {
+ const gchar *pattern = g_value_get_string(value);
+ if (priv->pattern) {
+ g_free(priv->pattern);
+ }
+ priv->pattern = g_strdup(pattern);
+ options->pattern = pattern ? pattern : "";
+ }
Review Comment:
Yes, I don't know why I thought that was needed. I removed the whole private
struct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]