"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/rbtree.cpp" between
bed-3.0.3.src.tar.xz and bed-3.1.0.src.tar.xz

About: bed is an adjustable data format binary editor.

rbtree.cpp  (bed-3.0.3.src.tar.xz):rbtree.cpp  (bed-3.1.0.src.tar.xz)
skipping to change at line 253 skipping to change at line 253
} }
} }
} }
color(root())=RBBLACK; color(root())=RBBLACK;
} }
void Tree::treeinsert(Treel *z) { void Tree::treeinsert(Treel *z) {
Treel *y=NIL; Treel *y=NIL;
Treel *x=root(); Treel *x=root();
while(x!=NIL) { while(x!=NIL) {
y=x; y=x;
if(compare(z,x)<0) if(compareel(z,x)<0)
x=left(x); x=left(x);
else else
x=right(x); x=right(x);
} }
p(z)=y; p(z)=y;
if(y==NIL) if(y==NIL)
root()=z; root()=z;
else { else {
if(compare(z,y)<0) if(compareel(z,y)<0)
left(y)=z; left(y)=z;
else else
right(y)=z; right(y)=z;
} }
} }
void Tree::insert(Data dat) { void Tree::insert(Data dat) {
Treel *ins=newtreel(); Treel *ins=newtreel();
ins->data=dat; ins->data=dat;
ins->left=ins->right=ins->parent=NIL; ins->left=ins->right=ins->parent=NIL;
skipping to change at line 342 skipping to change at line 342
Treel *Tree::search(Key k) { Treel *Tree::search(Key k) {
return treesearch(root(),k); return treesearch(root(),k);
} }
Treel *Tree::rightside(Key k) { Treel *Tree::rightside(Key k) {
return rightside(root(),k); return rightside(root(),k);
} }
Treel *Tree::rightside(Treel *x,Key k) { Treel *Tree::rightside(Treel *x,Key k) {
Treel *old=x; Treel *old=x;
int co; Key co;
while(x!=NIL && (co=comparekey(k,key(x)),co)) { while(x!=NIL && (co=comparekey(k,key(x)),co)) {
old=x; old=x;
if(co>0) { if(co>0) {
x=right(x); x=right(x);
if(x==NIL) { if(x==NIL) {
while(old!=NIL && x==right(old)) { while(old!=NIL && x==right(old)) {
x=old; x=old;
old=p(old); old=p(old);
} }
x=old; x=old;
skipping to change at line 369 skipping to change at line 369
} }
if(x==NIL) if(x==NIL)
return old; return old;
return x; return x;
} }
Treel *Tree::leftside(Key k) { Treel *Tree::leftside(Key k) {
return leftside(root(),k); return leftside(root(),k);
} }
Treel *Tree::leftside(Treel *x,Key k) { Treel *Tree::leftside(Treel *x,Key k) {
Treel *old=x; Treel *old=x;
int co; Key co;
while(x!=NIL && (co=comparekey(k,key(x)),co)) { while(x!=NIL && (co=comparekey(k,key(x)),co)) {
old=x; old=x;
if(co<0) { if(co<0) {
x=left(x); x=left(x);
if(x==NIL) { if(x==NIL) {
while(old!=NIL && x==left(old)) { while(old!=NIL && x==left(old)) {
x=old; x=old;
old=p(old); old=p(old);
} }
x=old; x=old;
skipping to change at line 393 skipping to change at line 393
else { else {
x=right(x); x=right(x);
} }
} }
if(x==NIL) if(x==NIL)
return old; return old;
return x; return x;
} }
Treel *Tree::treesearch(Treel *x,Key k) { Treel *Tree::treesearch(Treel *x,Key k) {
int co; Key co;
while(x!=NIL && (co=comparekey(k,key(x)),co)) while(x!=NIL && (co=comparekey(k,key(x)),co))
if(co<0) if(co<0)
x=left(x); x=left(x);
else else
x=right(x); x=right(x);
return x; return x;
} }
void Tree::rbdeletefixup(Treel *x) { void Tree::rbdeletefixup(Treel *x) {
Treel *w; Treel *w;
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)