[gnumeric] ssdiff: simplify cell handlers.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ssdiff: simplify cell handlers.
- Date: Mon, 24 Dec 2012 22:13:29 +0000 (UTC)
commit d6f19ab6abc18a5af4391a5c741f7dadf3ef300a
Author: Morten Welinder <terra gnome org>
Date: Mon Dec 24 14:27:08 2012 -0500
ssdiff: simplify cell handlers.
ChangeLog | 3 +++
src/ssdiff.c | 35 +++++++++++------------------------
2 files changed, 14 insertions(+), 24 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 717a9e4..7be0f11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2012-12-24 Morten Welinder <terra gnome org>
+ * src/ssdiff.c (def_cell_changed): Merge cell_added and
+ cell_removed handlers into the cell_changed handler.
+
* configure.in: ssconvert, ssindex, and ssgrep are no longer
configurable. We need ssconvert for the test and it's silly
anyway.
diff --git a/src/ssdiff.c b/src/ssdiff.c
index ce783dc..76bc3fb 100644
--- a/src/ssdiff.c
+++ b/src/ssdiff.c
@@ -53,13 +53,7 @@ typedef struct {
/* ------------------------------ */
- /* A cell was removed. */
- void (*cell_removed) (GnmDiffState *state, GnmCell const *oc);
-
- /* A cell was added. */
- void (*cell_added) (GnmDiffState *state, GnmCell const *nc);
-
- /* A cell's contents was changed. */
+ /* A cell was changed/added/removed. */
void (*cell_changed) (GnmDiffState *state, GnmCell const *oc, GnmCell const *nc);
} GnmDiffActions;
@@ -108,30 +102,23 @@ def_sheet_order_changed (GnmDiffState *state)
g_printerr (_("Sheet order changed.\n"));
}
-static void
-def_cell_removed (GnmDiffState *state, GnmCell const *oc)
-{
- g_printerr (_("Cell %s removed.\n"), def_cell_name (oc));
-}
-
-static void
-def_cell_added (GnmDiffState *state, GnmCell const *nc)
-{
- g_printerr (_("Cell %s added.\n"), def_cell_name (nc));
-}
-
static void
def_cell_changed (GnmDiffState *state, GnmCell const *oc, GnmCell const *nc)
{
- g_printerr (_("Cell %s changed.\n"), def_cell_name (oc));
+ if (oc && nc)
+ g_printerr (_("Cell %s changed.\n"), def_cell_name (oc));
+ else if (oc)
+ g_printerr (_("Cell %s removed.\n"), def_cell_name (oc));
+ else if (nc)
+ g_printerr (_("Cell %s added.\n"), def_cell_name (nc));
+ else
+ g_assert_not_reached ();
}
static const GnmDiffActions default_actions = {
def_sheet_removed,
def_sheet_added,
def_sheet_order_changed,
- def_cell_removed,
- def_cell_added,
def_cell_changed
};
@@ -195,10 +182,10 @@ diff_sheets_cells (GnmDiffState *state, Sheet *old_sheet, Sheet *new_sheet)
}
if (co) {
- state->actions->cell_removed (state, co);
+ state->actions->cell_changed (state, co, NULL);
io++;
} else if (cn) {
- state->actions->cell_added (state, cn);
+ state->actions->cell_changed (state, NULL, cn);
in++;
} else
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]