1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-04 23:29:42 +02:00

eeshow/delta.c (sheet_eq): sheet comparison, for history compression

This commit is contained in:
Werner Almesberger 2016-08-13 03:16:14 -03:00
parent d63c1a8ffe
commit 174a57d6c5
2 changed files with 26 additions and 0 deletions

View File

@ -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 */

View File

@ -17,6 +17,8 @@
#include "sch.h"
bool sheet_eq(const struct sheet *a, const struct sheet *b);
void delta(const struct sheet *a, const struct sheet *b,
struct sheet *res_a, struct sheet *res_b, struct sheet *res_ab);
void delta_free(struct sheet *d);