kd_search.c
/* intersect by checking the heads of the two lists.  Since they are
   sorted later (larger) first, delete the head which is greater than
   the other.  If the heads are the same, keep one and delete the
   other. */
intersect by checking the heads of the two lists.  Since they are
sorted later (larger) first, delete the head which is greater than
the other.  If the heads are the same, keep one and delete the
other.
intersect by checking the heads of the two lists . Since they are sorted later ( larger ) first delete the head which is greater than the other . If the heads are the same keep one and delete the other .
int wdes_intersect(llist *lout, void *e1, void *e2, void *c)
{
   unsigned char *wde1 = (unsigned char *) e1;
   unsigned char *wde2 = (unsigned char *) e2;
   int order;
   if (!e1) {
      malloc_elem_free(e2, NULL);
      return(LLIST_MERGE_DEL_2);
   }
   if (!e2) {
      malloc_elem_free(e1, NULL);
      return(LLIST_MERGE_DEL_1);
   }
   order = memcmp((void *) wde1, (void *) wde2, 12);
   if (order > 0) {
      malloc_elem_free(e1, NULL);
      return(LLIST_MERGE_DEL_1);
   }
   if (order < 0) {
      malloc_elem_free(e2, NULL);
      return(LLIST_MERGE_DEL_2);
   }
   if (!llist_add(lout, e1))
      return(LLIST_MERGE_FAIL);
   malloc_elem_free(e2, NULL);
   return(LLIST_MERGE_DEL_1 | LLIST_MERGE_DEL_2);
}
int wdes_intersect ( llist * lout , void * e1 , void * e2 , void * c ) { unsigned char * wde1 = ( unsigned char * ) e1 ; unsigned char * wde2 = ( unsigned char * ) e2 ; int order ; if ( ! e1 ) { malloc_elem_free ( e2 , NULL ) ; return ( LLIST_MERGE_DEL_2 ) ; } if ( ! e2 ) { malloc_elem_free ( e1 , NULL ) ; return ( LLIST_MERGE_DEL_1 ) ; } order = memcmp ( ( void * ) wde1 , ( void * ) wde2 , 12 ) ; if ( order > 0 ) { malloc_elem_free ( e1 , NULL ) ; return ( LLIST_MERGE_DEL_1 ) ; } if ( order < 0 ) { malloc_elem_free ( e2 , NULL ) ; return ( LLIST_MERGE_DEL_2 ) ; } if ( ! llist_add ( lout , e1 ) ) return ( LLIST_MERGE_FAIL ) ; malloc_elem_free ( e2 , NULL ) ; return ( LLIST_MERGE_DEL_1 | LLIST_MERGE_DEL_2 ) ; }
intersect by checking the heads of the two lists.
intersect by checking the heads of the two lists .
/* they're the same.  keep one */