The original void * version of the gavl_insert() does
not work correctly when insert mode with non-unique keys
(GAVL_FAFTER) is requested.
Bug reported by Rostislav Lisovy.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
break;
}
}
- if(mode&GAVL_FAFTER){
+ if((mode&GAVL_FAFTER)&&!(mode&GAVL_FCMP)){
if(cmp<=0)
if(p) p=gavl_next_node(p);
*nodep=p;
c=0;
scanf("%c",&c);
switch(c){
+ case 'A':
case 'a':
if (scanf("%d",&val)==1){
item=malloc(sizeof(test_item1_t));
item->val=val;
- ret=gavl_insert(&test_gavl1,item,0);
+ ret=gavl_insert(&test_gavl1,item,c == 'A'? GAVL_FAFTER: 0);
printf("gavl_insert of val %d returned %d\n\n",val,ret);
gavl_print_tree1(&test_gavl1, test_gavl1.root_node, 0, NULL, 0);
}