programmer in Finland.
Chris -)-----
* -------------------------------------------------------------------------- **
*
* Log: ubi_BinTree.c,v
* -------------------------------------------------------------------------- **
*
* Log: ubi_BinTree.c,v
+ * Revision 4.1 1998/03/31 06:11:57 crh
+ * Thomas Aglassinger sent E'mail pointing out errors in the
+ * dereferencing of function pointers, and a missing typecast.
+ * Thanks, Thomas!
+ *
* Revision 4.0 1998/03/10 03:19:22 crh
* Added the AVL field 'balance' to the ubi_btNode structure. This means
* that all BinTree modules now use the same basic node structure, which
* Revision 4.0 1998/03/10 03:19:22 crh
* Added the AVL field 'balance' to the ubi_btNode structure. This means
* that all BinTree modules now use the same basic node structure, which
*/
static char ModuleID[] = "ubi_BinTree\n\
*/
static char ModuleID[] = "ubi_BinTree\n\
-\tRevision: 4.0\n\
-\tDate: 1998/03/10 03:19:22\n\
+\tRevision: 4.1\n\
+\tDate: 1998/03/31 06:11:57\n\
\tAuthor: crh\n";
/* ========================================================================== **
\tAuthor: crh\n";
/* ========================================================================== **
* ------------------------------------------------------------------------ **
*/
{
* ------------------------------------------------------------------------ **
*/
{
- register ubi_btNodePtr tmp_p = p;
- ubi_btNodePtr tmp_pp = NULL;
- int tmp_gender = ubi_trEQUAL;
- int tmp_cmp;
+ register ubi_btNodePtr tmp_p = p;
+ ubi_btNodePtr tmp_pp = NULL;
+ signed char tmp_gender = ubi_trEQUAL;
+ int tmp_cmp;
while( tmp_p
&& (ubi_trEQUAL != (tmp_cmp = ubi_trAbNormal((*CmpFunc)(findme, tmp_p)))) )
{
tmp_pp = tmp_p; /* Keep track of previous node. */
while( tmp_p
&& (ubi_trEQUAL != (tmp_cmp = ubi_trAbNormal((*CmpFunc)(findme, tmp_p)))) )
{
tmp_pp = tmp_p; /* Keep track of previous node. */
- tmp_gender = tmp_cmp; /* Keep track of sex of child. */
+ tmp_gender = (signed char)tmp_cmp; /* Keep track of sex of child. */
tmp_p = tmp_p->Link[tmp_cmp]; /* Go to child. */
}
*parentp = tmp_pp; /* Return results. */
tmp_p = tmp_p->Link[tmp_cmp]; /* Go to child. */
}
*parentp = tmp_pp; /* Return results. */
- EachNode( p, UserData );
+ (*EachNode)( p, UserData );
p = ubi_btNext( p );
}
return( ubi_trTRUE );
p = ubi_btNext( p );
}
return( ubi_trTRUE );
p = q->Link[ubi_trPARENT];
if( p )
p->Link[ ((p->Link[ubi_trLEFT] == q)?ubi_trLEFT:ubi_trRIGHT) ] = NULL;
p = q->Link[ubi_trPARENT];
if( p )
p->Link[ ((p->Link[ubi_trLEFT] == q)?ubi_trLEFT:ubi_trRIGHT) ] = NULL;
+ (*FreeNode)((void *)q);
}
(void)ubi_btInitTree( RootPtr,
}
(void)ubi_btInitTree( RootPtr,
* -------------------------------------------------------------------------- **
*
* Log: ubi_BinTree.h,v
* -------------------------------------------------------------------------- **
*
* Log: ubi_BinTree.h,v
+ * Revision 4.1 1998/03/31 06:13:47 crh
+ * Thomas Aglassinger sent E'mail pointing out errors in the
+ * dereferencing of function pointers, and a missing typecast.
+ * Thanks, Thomas!
+ *
* Revision 4.0 1998/03/10 03:16:04 crh
* Added the AVL field 'balance' to the ubi_btNode structure. This means
* that all BinTree modules now use the same basic node structure, which
* Revision 4.0 1998/03/10 03:16:04 crh
* Added the AVL field 'balance' to the ubi_btNode structure. This means
* that all BinTree modules now use the same basic node structure, which
* -------------------------------------------------------------------------- **
*/
#define ubi_trNormalize(W) ((char)( (W) - ubi_trEQUAL ))
* -------------------------------------------------------------------------- **
*/
#define ubi_trNormalize(W) ((char)( (W) - ubi_trEQUAL ))
-#define ubi_trAbNormal(W) ((char)( ((char)ubi_btSgn( W )) + ubi_trEQUAL ))
+#define ubi_trAbNormal(W) ((char)( ((char)ubi_btSgn( (long)(W) )) \
+ + ubi_trEQUAL ))
#define ubi_trRevWay(W) ((char)( ubi_trEQUAL - ((W) - ubi_trEQUAL) ))
/* -------------------------------------------------------------------------- **
#define ubi_trRevWay(W) ((char)( ubi_trEQUAL - ((W) - ubi_trEQUAL) ))
/* -------------------------------------------------------------------------- **