deps/kb_meme/meme-5.0.1/src/array-list.c
/*
 * arraylst_map_range
 * Applies a function to each item in a range of the array list and updates 
 * the item to what was returned from the function.
 */
arraylst_map_range
Applies a function to each item in a range of the array list and updates
the item to what was returned from the function.
arraylst_map_range Applies a function to each item in a range of the array list and updates the item to what was returned from the function .
void arraylst_map_range(void* (*map_fun)(void*), int index, int count, ARRAYLST_T *arraylst) {
  int i;
  if (arraylst == NULL)                       die("arraylst_map_range: arraylst is NULL!\n"); 
  if (map_fun == NULL)                        die("arraylst_map_range: map_fun is NULL!\n");
  if (count < 0)                              die("arraylst_map_range: count must be zero or more elements.\n"); 
  if (index < 0 || index > arraylst->size)    die("arraylst_map_range: index must be within bounds.\n");
  if(index + count > arraylst->size)          die("arraylst_map_range: index + count is larger than size!\n");
  for (i = index; i < count; ++i) {
    arraylst->array[i] = map_fun(arraylst->array[i]);
  }
}
void arraylst_map_range ( void * ( * map_fun ) ( void * ) , int index , int count , ARRAYLST_T * arraylst ) { int i ; if ( arraylst == NULL ) die ( " \n " ) ; if ( map_fun == NULL ) die ( " \n " ) ; if ( count < 0 ) die ( " \n " ) ; if ( index < 0 || index > arraylst -> size ) die ( " \n " ) ; if ( index + count > arraylst -> size ) die ( " \n " ) ; for ( i = index ; i < count ; ++ i ) { arraylst -> array [ i ] = map_fun ( arraylst -> array [ i ] ) ; } }
arraylst_map_range
 Applies a function to each item in a range of the array list and updates
 the item to what was returned from the function.
arraylst_map_range Applies a function to each item in a range of the array list and updates the item to what was returned from the function .