comparison src/dynarr.c @ 647:b39c14581166

[xemacs-hg @ 2001-08-13 04:45:47 by ben] removal of unsigned, size_t, etc.
author ben
date Mon, 13 Aug 2001 04:46:48 +0000
parents abe6d1db359e
children fdefd0186b75
comparison
equal deleted inserted replaced
646:00c54252fe4f 647:b39c14581166
212 allocated beyond what was requested is returned in DYNARR_OVERHEAD 212 allocated beyond what was requested is returned in DYNARR_OVERHEAD
213 in STATS. The extra amount of space that malloc() allocates beyond 213 in STATS. The extra amount of space that malloc() allocates beyond
214 what was requested of it is returned in MALLOC_OVERHEAD in STATS. 214 what was requested of it is returned in MALLOC_OVERHEAD in STATS.
215 See the comment above the definition of this structure. */ 215 See the comment above the definition of this structure. */
216 216
217 size_t 217 Memory_Count
218 Dynarr_memory_usage (void *d, struct overhead_stats *stats) 218 Dynarr_memory_usage (void *d, struct overhead_stats *stats)
219 { 219 {
220 size_t total = 0; 220 Memory_Count total = 0;
221 Dynarr *dy = (Dynarr *) d; 221 Dynarr *dy = (Dynarr *) d;
222 222
223 /* We have to be a bit tricky here because not all of the 223 /* We have to be a bit tricky here because not all of the
224 memory that malloc() will claim as "requested" was actually 224 memory that malloc() will claim as "requested" was actually
225 requested. */ 225 requested. */
226 226
227 if (dy->base) 227 if (dy->base)
228 { 228 {
229 size_t malloc_used = malloced_storage_size (dy->base, 229 Memory_Count malloc_used = malloced_storage_size (dy->base,
230 dy->elsize * dy->max, 0); 230 dy->elsize * dy->max, 0);
231 /* #### This may or may not be correct. Some Dynarrs would 231 /* #### This may or may not be correct. Some Dynarrs would
232 prefer that we use dy->cur instead of dy->largest here. */ 232 prefer that we use dy->cur instead of dy->largest here. */
233 int was_requested = dy->elsize * dy->largest; 233 int was_requested = dy->elsize * dy->largest;
234 int dynarr_overhead = dy->elsize * (dy->max - dy->largest); 234 int dynarr_overhead = dy->elsize * (dy->max - dy->largest);