[beast/devel: 23/35] BSE: bseitem: use Rapicorn::string_format() for bse_item_undo_open()
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel: 23/35] BSE: bseitem: use Rapicorn::string_format() for bse_item_undo_open()
- Date: Tue, 14 May 2013 19:39:50 +0000 (UTC)
commit 99db57aae74cd0d560533e1a98a6e1ea4dbe49ec
Author: Tim Janik <timj gnu org>
Date: Mon May 13 03:11:01 2013 +0200
BSE: bseitem: use Rapicorn::string_format() for bse_item_undo_open()
bse/bseitem.cc | 26 ++++++--------------------
bse/bseitem.hh | 5 ++---
2 files changed, 8 insertions(+), 23 deletions(-)
---
diff --git a/bse/bseitem.cc b/bse/bseitem.cc
index 348e339..5cb26a5 100644
--- a/bse/bseitem.cc
+++ b/bse/bseitem.cc
@@ -870,7 +870,7 @@ undo_call_proc (BseUndoStep *ustep,
{
const char *packed_item_pointer = g_value_get_string (ivalues + 0);
BseItem *item = (BseItem*) bse_undo_pointer_unpack (packed_item_pointer, ustack);
- BseUndoStack *redo_stack = (BseUndoStack*) bse_item_undo_open (item, "%s", BSE_PROCEDURE_NAME (proc));
+ BseUndoStack *redo_stack = bse_item_undo_open (item, "%s", BSE_PROCEDURE_NAME (proc));
BseUndoStep *redo_step;
redo_step = bse_undo_step_new (undo_call_proc, unde_free_proc, 3);
redo_step->data[0].v_pointer = proc;
@@ -1160,31 +1160,17 @@ bse_item_set_property_undoable (BseItem *self,
}
BseUndoStack*
-bse_item_undo_open (void *item,
- const char *format,
- ...)
+bse_item_undo_open_str (void *item, const std::string &string)
{
- BseItem *self = BSE_ITEM (item);
- BseUndoStack *ustack;
- char *buffer;
- va_list args;
-
- g_return_val_if_fail (format != NULL, NULL);
-
- ustack = BSE_ITEM_GET_CLASS (self)->get_undo (self);
- va_start (args, format);
- buffer = g_strdup_vprintf (format, args);
- va_end (args);
+ BseItem *self = BSE_ITEM (item);
+ BseUndoStack *ustack = BSE_ITEM_GET_CLASS (self)->get_undo (self);
if (ustack)
- bse_undo_group_open (ustack, buffer);
+ bse_undo_group_open (ustack, string.c_str());
else
{
- char *str = g_strconcat ("DUMMY-GROUP(", buffer, ")", NULL);
ustack = bse_undo_stack_dummy ();
- bse_undo_group_open (ustack, str);
- g_free (str);
+ bse_undo_group_open (ustack, Rapicorn::string_format ("DUMMY-GROUP(%s)", string).c_str());
}
- g_free (buffer);
return ustack;
}
diff --git a/bse/bseitem.hh b/bse/bseitem.hh
index 970e3b1..f207d24 100644
--- a/bse/bseitem.hh
+++ b/bse/bseitem.hh
@@ -125,9 +125,8 @@ void bse_item_set_property_undoable (BseItem *self,
const gchar *name,
const GValue *value);
/* undo admin functions */
-BseUndoStack* bse_item_undo_open (gpointer item,
- const gchar *format,
- ...) G_GNUC_PRINTF (2, 3);
+BseUndoStack* bse_item_undo_open_str (void *item, const std::string &string);
+#define bse_item_undo_open(item,...) bse_item_undo_open_str (item, Rapicorn::string_format
(__VA_ARGS__).c_str())
void bse_item_undo_close (BseUndoStack *ustack);
/* undo helper functions */
void bse_item_push_undo_proc (gpointer item,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]