4) Bug in jsw_aerase:
Search for successor should save the path
*/
-#include "jsw_atree.h"
+#include "jsw.h"
-#ifdef __cplusplus
-#include <cstdlib>
-
-using std::malloc;
-using std::free;
-using std::size_t;
-#else
#include <stdlib.h>
-#endif
#ifndef HEIGHT_LIMIT
#define HEIGHT_LIMIT 64 /* Tallest allowable tree */
static jsw_anode_t *new_node ( jsw_atree_t *tree, void *data )
{
- jsw_anode_t *rn = (jsw_anode_t *)malloc ( sizeof *rn );
+ jsw_anode_t *rn = malloc ( sizeof *rn );
if ( rn == NULL )
return tree->nil;
jsw_atree_t *jsw_anew ( cmp_f cmp, dup_f dup, rel_f rel )
{
- jsw_atree_t *rt = (jsw_atree_t *)malloc ( sizeof *rt );
+ jsw_atree_t *rt = malloc ( sizeof *rt );
if ( rt == NULL )
return NULL;
/* Initialize sentinel */
- rt->nil = (jsw_anode_t *)malloc ( sizeof *rt->nil );
+ rt->nil = malloc ( sizeof *rt->nil );
if ( rt->nil == NULL ) {
free ( rt );
return NULL;