Repository: apache/arrow
File: c_glib/arrow-glib/compute.cpp (C++)

Code before:
  }
  G_OBJECT_CLASS(garrow_zero_fill_options_parent_class)->dispose(object);
}

static void
garrow_zero_fill_options_set_property(GObject *object,
                                      guint prop_id,
                                      const GValue *value,
                                      GParamSpec *pspec)
{
  auto options = garrow_zero_fill_options_get_raw(GARROW_ZERO_FILL_OPTIONS(object));
  auto priv = GARROW_ZERO_FILL_OPTIONS_GET_PRIVATE(object);

  switch (prop_id) {
  case PROP_ZERO_FILL_OPTIONS_WIDTH:
    options->width = g_value_get_int64(value);
    break;
  case PROP_ZERO_FILL_OPTIONS_PADDING:
    {
      const gchar *padding = g_value_get_string(value);
      if (priv->padding) {
        g_free(priv->padding);
      }
      priv->padding = g_strdup(padding);
      options->padding = padding ? padding : "";
    }
    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
    break;
  }
}

static void
garrow_zero_fill_options_get_property(GObject *object,
                                      guint prop_id,
                                      GValue *value,
                                      GParamSpec *pspec)
{
  auto options = garrow_zero_fill_options_get_raw(GARROW_ZERO_FILL_OPTIONS(object));
  auto priv = GARROW_ZERO_FILL_OPTIONS_GET_PRIVATE(object);

  switch (prop_id) {
  case PROP_ZERO_FILL_OPTIONS_WIDTH:
    g_value_set_int64(value, options->width);
    break;
  case PROP_ZERO_FILL_OPTIONS_PADDING:
    g_value_set_string(value, priv->padding ? priv->padding : options->padding.c_str());
    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);

Review comment (refactor):
Can we simplify this?

```suggestion
    options->padding =  g_value_get_string(value);
```

Code after:
   *
   * What day does the week start with (Monday=1, Sunday=7).
   * The numbering is unaffected by the count_from_zero parameter.
   *
   * Since: 23.0.0
   */
  spec = g_param_spec_uint("week-start",
                           "Week start",
                           "What day does the week start with (Monday=1, Sunday=7). The "
                           "numbering is unaffected by the count_from_zero parameter",
                           1,
                           7,
                           options.week_start,
                           static_cast<GParamFlags>(G_PARAM_READWRITE));
  g_object_class_install_property(gobject_class,
                                  PROP_DAY_OF_WEEK_OPTIONS_WEEK_START,
                                  spec);
}

/**
 * garrow_day_of_week_options_new:
 *
 * Returns: A newly created #GArrowDayOfWeekOptions.
 *
 * Since: 23.0.0
 */
GArrowDayOfWeekOptions *
garrow_day_of_week_options_new(void)
{
  auto options = g_object_new(GARROW_TYPE_DAY_OF_WEEK_OPTIONS, NULL);
  return GARROW_DAY_OF_WEEK_OPTIONS(options);
}

enum {
  PROP_EXTRACT_REGEX_OPTIONS_PATTERN = 1,
};

G_DEFINE_TYPE(GArrowExtractRegexOptions,
              garrow_extract_regex_options,
              GARROW_TYPE_FUNCTION_OPTIONS)

static void
garrow_extract_regex_options_set_property(GObject *object,
                                          guint prop_id,
                                          const GValue *value,
                                          GParamSpec *pspec)
{
  auto options =
    garrow_extract_regex_options_get_raw(GARROW_EXTRACT_REGEX_OPTIONS(object));

  switch (prop_id) {