- Sign was wrong in search_closest_smaller/greater
[tinc] / lib / avl_tree.c
index df7a036..341ffeb 100644 (file)
@@ -1,23 +1,23 @@
 /*
     avl_tree.c -- avl_ tree and linked list convenience
     Copyright (C) 1998 Michael H. Buselli
-                  2000 Ivo Timmermans <itimmermans@bigfoot.com>,
-                  2000 Guus Sliepen <guus@sliepen.warande.net>
-                  2000 Wessel Dankers <wsl@nl.linux.org>
+                  2000,2001 Ivo Timmermans <itimmermans@bigfoot.com>,
+                  2000,2001 Guus Sliepen <guus@sliepen.warande.net>
+                  2000,2001 Wessel Dankers <wsl@nl.linux.org>
 
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
 
-    This library is distributed in the hope that it will be useful,
+    This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
 
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     Original AVL tree library by Michael H. Buselli <cosine@cosine.org>.
 
@@ -29,7 +29,7 @@
     library for inclusion into tinc (http://tinc.nl.linux.org) by
     Guus Sliepen <guus@sliepen.warande.net>.
 
-    $Id: avl_tree.c,v 1.1.2.1 2001/01/05 23:50:56 guus Exp $
+    $Id: avl_tree.c,v 1.1.2.4 2001/01/08 21:32:00 guus Exp $
 */
 
 #include <stdio.h>
@@ -383,7 +383,7 @@ avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *tree, const void *
   
   node = avl_search_closest_node(tree, data, &result);
   
-  if(result > 0)
+  if(result < 0)
     node = node->prev;
   
   return node;
@@ -396,7 +396,7 @@ avl_node_t *avl_search_closest_greater_node(const avl_tree_t *tree, const void *
   
   node = avl_search_closest_node(tree, data, &result);
   
-  if(result < 0)
+  if(result > 0)
     node = node->next;
   
   return node;