@@ -1977,41 +1977,32 @@ xaccSplitGetType(const Split *s)
19771977{
19781978 if (!s) return nullptr ;
19791979
1980- GValue v = G_VALUE_INIT;
1981- const char * type;
1982- qof_instance_get_kvp (QOF_INSTANCE (s), &v, 1 , " split-type" );
1983- type = G_VALUE_HOLDS_STRING (&v) ? g_value_get_string (&v) : nullptr ;
1984- const char *rv;
1985- if (!type || !g_strcmp0 (type, split_type_normal))
1986- rv = split_type_normal;
1987- else if (!g_strcmp0 (type, split_type_stock_split))
1988- rv = split_type_stock_split;
1989- else
1990- {
1991- PERR (" unexpected split-type %s, reset to normal." , type);
1992- rv = split_type_normal;
1993- }
1994- g_value_unset (&v);
1995- return rv;
1980+ auto type{qof_instance_get_path_kvp<const char *> (QOF_INSTANCE (s), {" split-type" })};
1981+
1982+ if (!type || !g_strcmp0 (*type, split_type_normal))
1983+ return split_type_normal;
1984+
1985+ if (!g_strcmp0 (*type, split_type_stock_split))
1986+ return split_type_stock_split;
1987+
1988+ PERR (" unexpected split-type %s, reset to normal." , *type);
1989+ return split_type_normal;
19961990}
19971991
19981992/* reconfigure a split to be a stock split - after this, you shouldn't
19991993 mess with the value, just the amount. */
20001994void
20011995xaccSplitMakeStockSplit (Split *s)
20021996{
2003- GValue v = G_VALUE_INIT;
20041997 xaccTransBeginEdit (s->parent );
20051998
20061999 s->value = gnc_numeric_zero ();
2007- g_value_init (&v, G_TYPE_STRING);
2008- g_value_set_static_string (&v, split_type_stock_split);
2009- qof_instance_set_kvp (QOF_INSTANCE (s), &v, 1 , " split-type" );
2000+ qof_instance_set_path_kvp<const char *> (QOF_INSTANCE (s), g_strdup (split_type_stock_split),
2001+ {" split-type" });
20102002 SET_GAINS_VDIRTY (s);
20112003 mark_split (s);
20122004 qof_instance_set_dirty (QOF_INSTANCE (s));
20132005 xaccTransCommitEdit (s->parent );
2014- g_value_unset (&v);
20152006}
20162007
20172008void
0 commit comments