Replace glibc tsearch() with a custom red-black tree implementation.

The library supplied tree estructure is not enought for our needs, due to its
limited API. Thus, we have implemented a suitable red-black tree.
This commit is contained in:
Vreixo Formoso
2007-12-20 00:25:25 +01:00
parent 5eb3a7e038
commit e6bd1586d6
9 changed files with 422 additions and 31 deletions

View File

@ -29,7 +29,7 @@ void ecma119_image_free(Ecma119Image *t)
ecma119_node_free(t->root);
iso_image_unref(t->image);
iso_file_src_free(t);
iso_rbtree_destroy(t->files, iso_file_src_free);
for (i = 0; i < t->nwriters; ++i) {
IsoImageWriter *writer = t->writers[i];
@ -293,6 +293,13 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts,
return ISO_MEM_ERROR;
}
/* create the tree for file caching */
ret = iso_rbtree_new(iso_file_src_cmp, &(target->files));
if (ret < 0) {
free(target);
return ret;
}
target->image = src;
iso_image_ref(src);
@ -303,6 +310,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts,
target->ms_block = 0;
target->input_charset = strdup("UTF-8"); //TODO
/*
* 2. Based on those options, create needed writers: iso, joliet...
* Each writer inits its structures and stores needed info into