lib/libvfio-user.c
/*
 * This function is used to add fd's to the fd return array and gives you back
 * the index of the fd that has been added. If the fd is already present it will
 * return the index to that duplicate fd to reduce the number of fd's sent.
 */
This function is used to add fd's to the fd return array and gives you back
the index of the fd that has been added. If the fd is already present it will
return the index to that duplicate fd to reduce the number of fd's sent.
This function is used to add fd ' s to the fd return array and gives you back the index of the fd that has been added . If the fd is already present it will return the index to that duplicate fd to reduce the number of fd ' s sent .
static int
add_fd_index(int *out_fds, size_t *nr_out_fds, int fd_search)
{
    size_t i = 0;
    assert(out_fds != NULL);
    assert(nr_out_fds != NULL);
    for (i = 0; i < *nr_out_fds; i++) {
        if (out_fds[i] == fd_search) {
            return i;
        }
    }
    out_fds[*nr_out_fds] = fd_search;
    (*nr_out_fds)++;
    return *nr_out_fds - 1;
}
static int add_fd_index ( int * out_fds , size_t * nr_out_fds , int fd_search ) { size_t i = 0 ; assert ( out_fds != NULL ) ; assert ( nr_out_fds != NULL ) ; for ( i = 0 ; i < * nr_out_fds ; i ++ ) { if ( out_fds [ i ] == fd_search ) { return i ; } } out_fds [ * nr_out_fds ] = fd_search ; ( * nr_out_fds ) ++ ; return * nr_out_fds - 1 ; }
This function is used to add fd's to the fd return array and gives you back
 the index of the fd that has been added.
This function is used to add fd ' s to the fd return array and gives you back the index of the fd that has been added .