diff ListOfArrays.c @ 5:79982974d355

fix bug when last fragment exactly full
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Thu, 08 Mar 2012 19:05:26 +0100
parents 9c577efe70cd
children 94a5b324bc29
line diff
     1.1 --- a/ListOfArrays.c	Wed Dec 21 16:55:02 2011 +0100
     1.2 +++ b/ListOfArrays.c	Thu Mar 08 19:05:26 2012 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  
     1.5  #include "ListOfArrays.h"
     1.6 -#include "../vmalloc.h"
     1.7 +#include "../../VMS_Implementations/VMS_impl/vmalloc.h"
     1.8  
     1.9  ListOfArrays* makeListOfArrays(size_t entry_size, int num_entries_per_block){
    1.10      ListOfArrays* newLoA = (ListOfArrays*) VMS__malloc(sizeof(ListOfArrays));
    1.11 @@ -16,7 +16,8 @@
    1.12  void forAllInListOfArraysDo(ListOfArrays* list, ListOfArraysFnPtr fnPtr){
    1.13      int n;
    1.14      uintptr_t p;
    1.15 -    for(n=0;n<list->dim1info->numInArray -1; n++){
    1.16 +    int num_full = list->next_free_index / list->num_entries_per_fragment; //list->dim1info->numInArray -1
    1.17 +    for(n=0;n<num_full; n++){
    1.18          for(p = (uintptr_t) (list->dim1)[n]; p < (uintptr_t) (list->dim1)[n] + list->num_entries_per_fragment * list->entry_size; p += list->entry_size){
    1.19              (*fnPtr)((void*)p);
    1.20          }