jukefs: fix realloc sizes (thanks mischief)
This commit is contained in:
parent
60cbbb123b
commit
f2d2f9374b
|
@ -436,7 +436,7 @@ addchild(Object *parent, Object *child, char *where)
|
||||||
*/
|
*/
|
||||||
for(i = 0; i < parent->nchildren; i++)
|
for(i = 0; i < parent->nchildren; i++)
|
||||||
if(parent->children[i] == child) return;
|
if(parent->children[i] == child) return;
|
||||||
parent->children = realloc(parent->children, (i+1)*4);
|
parent->children = realloc(parent->children, (i+1)*sizeof(Object*));
|
||||||
parent->children[i] = child;
|
parent->children[i] = child;
|
||||||
parent->nchildren++;
|
parent->nchildren++;
|
||||||
if(parent->type == Category && child->type == Category)
|
if(parent->type == Category && child->type == Category)
|
||||||
|
@ -457,7 +457,7 @@ addchild(Object *parent, Object *child, char *where)
|
||||||
i = child->ncatparents;
|
i = child->ncatparents;
|
||||||
if(0) fprint(2, "addcatparent %s parent %d type %d child %d type %d\n",where,
|
if(0) fprint(2, "addcatparent %s parent %d type %d child %d type %d\n",where,
|
||||||
parent->tabno, parent->type, child->tabno, child->type);
|
parent->tabno, parent->type, child->tabno, child->type);
|
||||||
child->catparents = realloc(child->catparents, (i+1)*4);
|
child->catparents = realloc(child->catparents, (i+1)*sizeof(Object*));
|
||||||
child->catparents[i] = parent;
|
child->catparents[i] = parent;
|
||||||
child->ncatparents++;
|
child->ncatparents++;
|
||||||
}
|
}
|
||||||
|
@ -476,7 +476,7 @@ addcatparent(Object *parent, Object *child)
|
||||||
// if(child->catparents[i] == parent) return;
|
// if(child->catparents[i] == parent) return;
|
||||||
i = child->ncatparents;
|
i = child->ncatparents;
|
||||||
fprint(2, "addcatparent parent %d child %d\n", parent->tabno, child->tabno);
|
fprint(2, "addcatparent parent %d child %d\n", parent->tabno, child->tabno);
|
||||||
child->catparents = realloc(child->catparents, (i+1)*4);
|
child->catparents = realloc(child->catparents, (i+1)*sizeof(Object*));
|
||||||
child->catparents[i] = parent;
|
child->catparents[i] = parent;
|
||||||
child->ncatparents++;
|
child->ncatparents++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue