diff options
Diffstat (limited to 'src/cmd/fossil/view.c')
-rw-r--r-- | src/cmd/fossil/view.c | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/src/cmd/fossil/view.c b/src/cmd/fossil/view.c index 54a55861..645a45a1 100644 --- a/src/cmd/fossil/view.c +++ b/src/cmd/fossil/view.c @@ -463,7 +463,7 @@ initxlabel(Label l) typedef struct Xblock Xblock; struct Xblock { - Tnode; + Tnode *t; Block *b; int (*gen)(void*, Block*, int, Tnode**); void *arg; @@ -478,57 +478,58 @@ xblockexpand(Tnode *tt) Xblock *t = (Xblock*)tt; Tnode *nn; - if(t->nkid >= 0) + if(t->t->nkid >= 0) return; j = 0; if(t->printlabel){ - t->kid = mallocz(Q*sizeof(t->kid[0]), 1); - t->kid[0] = initxlabel(t->b->l); + t->t->kid = mallocz(Q*sizeof(t->t->kid[0]), 1); + t->t->kid[0] = initxlabel(t->b->l); j = 1; } for(i=0;; i++){ switch((*t->gen)(t->arg, t->b, i, &nn)){ case -1: - t->nkid = j; + t->t->nkid = j; return; case 0: break; case 1: if(j%Q == 0) - t->kid = realloc(t->kid, (j+Q)*sizeof(t->kid[0])); - t->kid[j++] = nn; + t->t->kid = realloc(t->t->kid, (j+Q)*sizeof(t->t->kid[0])); + t->t->kid[j++] = nn; break; } } } int -nilgen(void*, Block*, int, Tnode**) +nilgen(void *v, Block *b, int o, Tnode **tp) { return -1; } Tnode* -initxblock(Block *b, char *s, int (*gen)(void*, Block*, int, Tnode**), void *arg) +initxblock(Block *b, char *s, int (*gen)(void *v, Block *b, int o, Tnode **tp), void *arg) { Xblock *t; if(gen == nil) gen = nilgen; t = mallocz(sizeof(Xblock), 1); + t->t = mallocz(sizeof(Tnode), 1); t->b = b; t->gen = gen; t->arg = arg; if(b->addr == NilBlock) - t->str = smprint("Block %V: %s", b->score, s); + t->t->str = smprint("Block %V: %s", b->score, s); else - t->str = smprint("Block %#ux: %s", b->addr, s); + t->t->str = smprint("Block %#ux: %s", b->addr, s); t->printlabel = 1; - t->nkid = -1; - t->expand = xblockexpand; - return t; + t->t->nkid = -1; + t->t->expand = xblockexpand; + return t->t; } int @@ -557,7 +558,7 @@ initxentryblock(Block *b, Entry *ed) typedef struct Xentry Xentry; struct Xentry { - Tnode; + Tnode *t; Entry e; }; @@ -566,12 +567,12 @@ xentryexpand(Tnode *tt) { Xentry *t = (Xentry*)tt; - if(t->nkid >= 0) + if(t->t->nkid >= 0) return; - t->nkid = 1; - t->kid = mallocz(sizeof(t->kid[0])*t->nkid, 1); - t->kid[0] = initxsource(t->e, 1); + t->t->nkid = 1; + t->t->kid = mallocz(sizeof(t->t->kid[0])*t->t->nkid, 1); + t->t->kid[0] = initxsource(t->e, 1); } Tnode* @@ -580,14 +581,15 @@ initxentry(Entry e) Xentry *t; t = mallocz(sizeof *t, 1); - t->nkid = -1; - t->str = smprint("Entry gen=%#ux psize=%d dsize=%d depth=%d flags=%#ux size=%lld score=%V", + t->t = mallocz(sizeof(Tnode), 1); + t->t->nkid = -1; + t->t->str = smprint("Entry gen=%#ux psize=%d dsize=%d depth=%d flags=%#ux size=%lld score=%V", e.gen, e.psize, e.dsize, e.depth, e.flags, e.size, e.score); if(e.flags & VtEntryLocal) - t->str = smprint("%s archive=%d snap=%d tag=%#ux", t->str, e.archive, e.snap, e.tag); - t->expand = xentryexpand; + t->t->str = smprint("%s archive=%d snap=%d tag=%#ux", t->t->str, e.archive, e.snap, e.tag); + t->t->expand = xentryexpand; t->e = e; - return t; + return t->t; } int @@ -659,7 +661,7 @@ initxsource(Entry e, int dowrap) } int -xlocalrootgen(void*, Block *b, int o, Tnode **tp) +xlocalrootgen(void *v, Block *b, int o, Tnode **tp) { Entry e; @@ -684,7 +686,7 @@ initxlocalroot(char *name, u32int addr) } int -xvacrootgen(void*, Block *b, int o, Tnode **tp) +xvacrootgen(void *v, Block *b, int o, Tnode **tp) { Entry e; @@ -734,7 +736,7 @@ initxdirentry(MetaEntry *me) } int -metaentrygen(void *v, Block*, int o, Tnode **tp) +metaentrygen(void *v, Block *b, int o, Tnode **tp) { Tnode *t; MetaBlock *mb; @@ -765,11 +767,11 @@ metablockgen(void *v, Block *b, int o, Tnode **tp) /* hack: reuse initxblock as a generic iterator */ mb = v; t = (Xblock*)initxblock(b, "", metaentrygen, mb); - t->str = smprint("MetaBlock %d/%d space used, %d add'l free %d/%d table used%s", + t->t->str = smprint("MetaBlock %d/%d space used, %d add'l free %d/%d table used%s", mb->size, mb->maxsize, mb->free, mb->nindex, mb->maxindex, mb->botch ? " [BOTCH]" : ""); t->printlabel = 0; - *tp = t; + *tp = t->t; return 1; } |