summaryrefslogtreecommitdiff
path: root/delta.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-13 03:16:14 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-13 03:16:14 -0300
commit3fd43e0f89eb6cd36b8a3433ed2f5be5f522165b (patch)
tree74599367007bb9cfeac400196e2f919c01782df3 /delta.c
parent11522ef290225e585b8370681f5f3070eabc3682 (diff)
downloadeeshow-3fd43e0f89eb6cd36b8a3433ed2f5be5f522165b.tar.gz
eeshow-3fd43e0f89eb6cd36b8a3433ed2f5be5f522165b.tar.bz2
eeshow-3fd43e0f89eb6cd36b8a3433ed2f5be5f522165b.zip
eeshow/delta.c (sheet_eq): sheet comparison, for history compression
Diffstat (limited to 'delta.c')
-rw-r--r--delta.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/delta.c b/delta.c
index fe89233..b9a9473 100644
--- a/delta.c
+++ b/delta.c
@@ -284,6 +284,30 @@ static bool obj_eq(const struct sch_obj *a, const struct sch_obj *b)
}
+bool sheet_eq(const struct sheet *a, const struct sheet *b)
+{
+ const struct sch_obj *obj_a, *obj_b;
+
+ if (a == NULL && b == NULL)
+ return 1;
+ if (!(a && b))
+ return 0;
+
+ if (a->title != b->title && strcmp(a->title, b->title))
+ return 0;
+
+ obj_a = a->objs;
+ obj_b = b->objs;
+ while (obj_a && obj_b) {
+ if (!obj_eq(obj_a, obj_b))
+ return 0;
+ obj_a = obj_a->next;
+ obj_b = obj_b->next;
+ }
+ return obj_a == obj_b;
+}
+
+
static void free_obj(struct sch_obj *obj)
{
/* there may be more to free once we get into cloning components */