1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-09-30 00:35:05 +03:00

eeshow/sch.h (struct sheet.parent): remove; we can just record it locally

This commit is contained in:
Werner Almesberger 2016-08-10 19:41:17 -03:00
parent 8f352832e0
commit 9524447bf1
3 changed files with 5 additions and 14 deletions

View File

@ -278,7 +278,6 @@ static void init_res(struct sheet *res)
res->title = NULL;
res->objs = NULL;
res->next_obj = &res->objs;
res->parent = NULL;
res->next = NULL;
}

View File

@ -292,7 +292,6 @@ static struct sheet *new_sheet(struct sch_ctx *ctx)
sheet->oid = NULL;
sheet->parent = ctx->curr_sheet;
ctx->curr_sheet = sheet;
*ctx->next_sheet = sheet;
@ -302,13 +301,6 @@ static struct sheet *new_sheet(struct sch_ctx *ctx)
}
static void end_sheet(struct sch_ctx *ctx)
{
ctx->curr_sheet = ctx->curr_sheet->parent;
assert(ctx->curr_sheet);
}
static bool parse_line(const struct file *file, void *user, const char *line);
@ -317,7 +309,7 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
const struct file *related)
{
const char *name = ctx->obj.u.sheet.file;
struct sheet *sheet;
struct sheet *parent, *sheet;
struct file file;
void *oid;
bool res;
@ -325,6 +317,7 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
if (!file_open(&file, name, related))
return NULL;
parent = ctx->curr_sheet;
sheet = new_sheet(ctx);
oid = file_oid(&file);
sheet->oid = oid;
@ -335,7 +328,7 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
for (other = ctx->prev->sheets; other; other = other->next)
if (!other->has_children &&
file_oid_eq(other->oid, oid)) {
end_sheet(ctx);
ctx->curr_sheet = parent;
sheet->title = other->title;
sheet->objs = other->objs;
return sheet;
@ -347,9 +340,9 @@ static const struct sheet *recurse_sheet(struct sch_ctx *ctx,
file_close(&file);
if (!res)
return NULL; /* leave it to caller to clean up */
end_sheet(ctx);
ctx->curr_sheet->has_children = 1;
ctx->curr_sheet = parent;
parent->has_children = 1;
return sheet;
}

View File

@ -96,7 +96,6 @@ struct sheet {
const char *title; /* malloced, unless delta */
struct sch_obj *objs;
struct sch_obj **next_obj;
struct sheet *parent;
struct sheet *next;
bool has_children; /* aka sub-sheets */