src/siri/db/points.c
/*
 * Sort points by time-stamp.
 *
 * Warning: this function should only be used in another thread.
 */
Sort points by time-stamp.
Warning: this function should only be used in another thread.
Sort points by time - stamp . Warning : this function should only be used in another thread .
static void POINTS_simple_sort(siridb_points_t * points)
{
    if (points->len < 2)
    {
        return;  
    }
    size_t n = 0;
    size_t i;
    siridb_point_t * pa, * pb;
    siridb_point_t tmp;
    while(++n < points->len)
    {
        pa = points->data + n - 1;
        pb = points->data + n;
        if (pa->ts > pb->ts)
        {
            tmp = points->data[n];
            i = n;
            do
            {
                points->data[i] = points->data[i - 1];
            }
            while (--i && points->data[i - 1].ts > tmp.ts);
            points->data[i] = tmp;
            usleep(100);
        }
    }
}
static void POINTS_simple_sort ( siridb_points_t * points ) { if ( points -> len < 2 ) { return ; } size_t n = 0 ; size_t i ; siridb_point_t * pa , * pb ; siridb_point_t tmp ; while ( ++ n < points -> len ) { pa = points -> data + n - 1 ; pb = points -> data + n ; if ( pa -> ts > pb -> ts ) { tmp = points -> data [ n ] ; i = n ; do { points -> data [ i ] = points -> data [ i - 1 ] ; } while ( -- i && points -> data [ i - 1 ] . ts > tmp . ts ) ; points -> data [ i ] = tmp ; usleep ( 100 ) ; } } }
Sort points by time-stamp.
Sort points by time - stamp .
/* nothing to do... */