fossil: fix p9p changes on view
LGTM=rsc R=rsc https://codereview.appspot.com/31130043
This commit is contained in:
parent
20035ed43c
commit
24b8994d3d
1 changed files with 28 additions and 26 deletions
|
|
@ -463,7 +463,7 @@ initxlabel(Label l)
|
||||||
typedef struct Xblock Xblock;
|
typedef struct Xblock Xblock;
|
||||||
struct Xblock
|
struct Xblock
|
||||||
{
|
{
|
||||||
Tnode *t;
|
Tnode t;
|
||||||
Block *b;
|
Block *b;
|
||||||
int (*gen)(void*, Block*, int, Tnode**);
|
int (*gen)(void*, Block*, int, Tnode**);
|
||||||
void *arg;
|
void *arg;
|
||||||
|
|
@ -478,27 +478,27 @@ xblockexpand(Tnode *tt)
|
||||||
Xblock *t = (Xblock*)tt;
|
Xblock *t = (Xblock*)tt;
|
||||||
Tnode *nn;
|
Tnode *nn;
|
||||||
|
|
||||||
if(t->t->nkid >= 0)
|
if(t->t.nkid >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
if(t->printlabel){
|
if(t->printlabel){
|
||||||
t->t->kid = mallocz(Q*sizeof(t->t->kid[0]), 1);
|
t->t.kid = mallocz(Q*sizeof(t->t.kid[0]), 1);
|
||||||
t->t->kid[0] = initxlabel(t->b->l);
|
t->t.kid[0] = initxlabel(t->b->l);
|
||||||
j = 1;
|
j = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;; i++){
|
for(i=0;; i++){
|
||||||
switch((*t->gen)(t->arg, t->b, i, &nn)){
|
switch((*t->gen)(t->arg, t->b, i, &nn)){
|
||||||
case -1:
|
case -1:
|
||||||
t->t->nkid = j;
|
t->t.nkid = j;
|
||||||
return;
|
return;
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if(j%Q == 0)
|
if(j%Q == 0)
|
||||||
t->t->kid = realloc(t->t->kid, (j+Q)*sizeof(t->t->kid[0]));
|
t->t.kid = realloc(t->t.kid, (j+Q)*sizeof(t->t.kid[0]));
|
||||||
t->t->kid[j++] = nn;
|
t->t.kid[j++] = nn;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -518,18 +518,17 @@ initxblock(Block *b, char *s, int (*gen)(void *v, Block *b, int o, Tnode **tp),
|
||||||
if(gen == nil)
|
if(gen == nil)
|
||||||
gen = nilgen;
|
gen = nilgen;
|
||||||
t = mallocz(sizeof(Xblock), 1);
|
t = mallocz(sizeof(Xblock), 1);
|
||||||
t->t = mallocz(sizeof(Tnode), 1);
|
|
||||||
t->b = b;
|
t->b = b;
|
||||||
t->gen = gen;
|
t->gen = gen;
|
||||||
t->arg = arg;
|
t->arg = arg;
|
||||||
if(b->addr == NilBlock)
|
if(b->addr == NilBlock)
|
||||||
t->t->str = smprint("Block %V: %s", b->score, s);
|
t->t.str = smprint("Block %V: %s", b->score, s);
|
||||||
else
|
else
|
||||||
t->t->str = smprint("Block %#ux: %s", b->addr, s);
|
t->t.str = smprint("Block %#ux: %s", b->addr, s);
|
||||||
t->printlabel = 1;
|
t->printlabel = 1;
|
||||||
t->t->nkid = -1;
|
t->t.nkid = -1;
|
||||||
t->t->expand = xblockexpand;
|
t->t.expand = xblockexpand;
|
||||||
return t->t;
|
return (Tnode*)t;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -558,7 +557,7 @@ initxentryblock(Block *b, Entry *ed)
|
||||||
typedef struct Xentry Xentry;
|
typedef struct Xentry Xentry;
|
||||||
struct Xentry
|
struct Xentry
|
||||||
{
|
{
|
||||||
Tnode *t;
|
Tnode t;
|
||||||
Entry e;
|
Entry e;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -567,12 +566,12 @@ xentryexpand(Tnode *tt)
|
||||||
{
|
{
|
||||||
Xentry *t = (Xentry*)tt;
|
Xentry *t = (Xentry*)tt;
|
||||||
|
|
||||||
if(t->t->nkid >= 0)
|
if(t->t.nkid >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t->t->nkid = 1;
|
t->t.nkid = 1;
|
||||||
t->t->kid = mallocz(sizeof(t->t->kid[0])*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);
|
t->t.kid[0] = initxsource(t->e, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tnode*
|
Tnode*
|
||||||
|
|
@ -581,15 +580,14 @@ initxentry(Entry e)
|
||||||
Xentry *t;
|
Xentry *t;
|
||||||
|
|
||||||
t = mallocz(sizeof *t, 1);
|
t = mallocz(sizeof *t, 1);
|
||||||
t->t = mallocz(sizeof(Tnode), 1);
|
t->t.nkid = -1;
|
||||||
t->t->nkid = -1;
|
t->t.str = smprint("Entry gen=%#ux psize=%d dsize=%d depth=%d flags=%#ux size=%lld score=%V",
|
||||||
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);
|
e.gen, e.psize, e.dsize, e.depth, e.flags, e.size, e.score);
|
||||||
if(e.flags & VtEntryLocal)
|
if(e.flags & VtEntryLocal)
|
||||||
t->t->str = smprint("%s archive=%d snap=%d tag=%#ux", t->t->str, e.archive, e.snap, e.tag);
|
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->t.expand = xentryexpand;
|
||||||
t->e = e;
|
t->e = e;
|
||||||
return t->t;
|
return (Tnode*)t;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -767,11 +765,11 @@ metablockgen(void *v, Block *b, int o, Tnode **tp)
|
||||||
/* hack: reuse initxblock as a generic iterator */
|
/* hack: reuse initxblock as a generic iterator */
|
||||||
mb = v;
|
mb = v;
|
||||||
t = (Xblock*)initxblock(b, "", metaentrygen, mb);
|
t = (Xblock*)initxblock(b, "", metaentrygen, mb);
|
||||||
t->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->size, mb->maxsize, mb->free, mb->nindex, mb->maxindex,
|
||||||
mb->botch ? " [BOTCH]" : "");
|
mb->botch ? " [BOTCH]" : "");
|
||||||
t->printlabel = 0;
|
t->printlabel = 0;
|
||||||
*tp = t->t;
|
*tp = (Tnode*)t;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1055,7 +1053,11 @@ threadmain(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
fs = atreeinit(dir);
|
fs = atreeinit(dir);
|
||||||
|
#ifdef PLAN9PORT
|
||||||
|
initdraw(0, "/lib/font/bit/lucsans/unicode.8.font", "tree");
|
||||||
|
#else
|
||||||
initdraw(0, "/lib/font/bit/lucidasans/unicode.8.font", "tree");
|
initdraw(0, "/lib/font/bit/lucidasans/unicode.8.font", "tree");
|
||||||
|
#endif
|
||||||
t.root = fs->root;
|
t.root = fs->root;
|
||||||
t.offset = ZP;
|
t.offset = ZP;
|
||||||
t.clipr = allocimage(display, Rect(0,0,1,1), GREY1, 1, DOpaque);
|
t.clipr = allocimage(display, Rect(0,0,1,1), GREY1, 1, DOpaque);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue