Example #1
0
Local int
compare(FIELD_PTR *a, FIELD_PTR *b)

{
    int     i;
    int     dif;

    idx_gc++;
    idx_dot = True; 
    if(idx_dc++ == 0) 
	Message(DOT); 
    if(idx_dc == CMP_MAX) 
	idx_dc = 0; 

    for(i = 0; i < FIELD_MAX; i++) 
       {
					    /* compare the sort fields */
	if((dif = compare_one((*a)->sf[i], (*b)->sf[i])) != 0)
	    break;

	if((dif = compare_one((*a)->af[i], (*b)->af[i])) != 0)
	    break;
       }

		/* both key aggregates are identical, compare page numbers */
    if(i == FIELD_MAX)
	dif = compare_page(a, b);
    return(dif);
}
Example #2
0
static int
compare(const void *va, const void *vb)
{
#if defined(MIKTEX)
    const FIELD_PTR *a = (FIELD_PTR*)va;
    const FIELD_PTR *b = (FIELD_PTR*)vb;
#else
    const FIELD_PTR *a = va;
    const FIELD_PTR *b = vb;
#endif
    int     i;
    int     dif;

    idx_gc++;
    IDX_DOT(CMP_MAX);

    for (i = 0; i < FIELD_MAX; i++) {
	/* compare the sort fields */
	if ((dif = compare_one((*a)->sf[i], (*b)->sf[i])) != 0)
	    break;

	/* compare the actual fields */
	if ((dif = compare_one((*a)->af[i], (*b)->af[i])) != 0)
	    break;
    }

    /* both key aggregates are identical, compare page numbers */
    if (i == FIELD_MAX)
	dif = compare_page(a, b);
    return (dif);
}