Changeset 0f15f12
- Timestamp:
- Aug 20, 2009, 9:19:01 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- f278ff3
- Parents:
- 5ebc202
- git-author:
- Anders Kaseorg <andersk@mit.edu> (08/20/09 21:14:37)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (08/20/09 21:19:01)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
dict.c
r8bce750 r0f15f12 13 13 14 14 #define INITSIZE 30 15 #define GROWAT 2 16 #define GROWBY 1.5 15 #define GROWBY 3 / 2 17 16 18 17 int owl_dict_create(owl_dict *d) { … … 93 92 return(-2); 94 93 } else { 95 if ((d->size+1) > (d->avail/GROWAT)) { 96 d->els=owl_realloc(d->els, d->avail*GROWBY*sizeof(void *)); 97 d->avail=d->avail*GROWBY; 94 if (d->size + 1 > d->avail) { 95 int avail = MAX(d->avail * GROWBY, d->size + 1); 96 d->els = owl_realloc(d->els, avail * sizeof(owl_dict_el)); 97 d->avail = avail; 98 98 if (d->els==NULL) return(-1); 99 99 } -
list.c
r77bced3 r0f15f12 3 3 4 4 #define INITSIZE 10 5 #define GROWBY 1.55 #define GROWBY 3 / 2 6 6 7 7 int owl_list_create(owl_list *l) … … 25 25 26 26 if ((l->size+n) > l->avail) { 27 ptr=owl_realloc(l->list, l->avail*GROWBY*sizeof(void *)); 27 int avail = MAX(l->avail * GROWBY, l->size + n); 28 ptr = owl_realloc(l->list, avail * sizeof(void *)); 28 29 if (ptr==NULL) abort(); 29 30 l->list=ptr; 30 l->avail =l->avail*GROWBY;31 l->avail = avail; 31 32 } 32 33
Note: See TracChangeset
for help on using the changeset viewer.