Revision: 55058
http://brlcad.svn.sourceforge.net/brlcad/?rev=55058&view=rev
Author: brlcad
Date: 2013-04-05 05:37:31 +0000 (Fri, 05 Apr 2013)
Log Message:
-----------
because it's awesome when structure elements all line up perfectly with the
same length
Modified Paths:
--------------
brlcad/trunk/src/libbu/heap.c
Modified: brlcad/trunk/src/libbu/heap.c
===================================================================
--- brlcad/trunk/src/libbu/heap.c 2013-04-05 05:29:22 UTC (rev 55057)
+++ brlcad/trunk/src/libbu/heap.c 2013-04-05 05:37:31 UTC (rev 55058)
@@ -67,10 +67,10 @@
size_t count;
/**
- * used tabulates how much memory the current page is using
- * (allocated). it's not a counter so we can avoid a multiply.
+ * given tabulates how much memory the current page has been
+ * allocated to callers. not a counter to avoid a multiply.
*/
- size_t used;
+ size_t given;
};
struct cpus {
@@ -119,7 +119,7 @@
if (got > 0) {
/* last page is partial */
- got -= (PAGESIZE - per_cpu[h].heap[i].used)/(i+1);
+ got -= (PAGESIZE - per_cpu[h].heap[i].given)/(i+1);
bu_log("%04zu [%02zu] => %zu\n", i, per_cpu[h].heap[i].count,
got);
allocs += got;
}
@@ -175,20 +175,20 @@
heap->count++;
heap->pages = (char **)bu_malloc(1 * sizeof(char *), "heap malloc
pages[]");
heap->pages[0] = (char *)bu_calloc(1, PAGESIZE, "heap calloc
pages[][0]");
- heap->used = 0;
+ heap->given = 0;
}
/* grow */
- if (heap->used+sz > PAGESIZE) {
+ if (heap->given+sz > PAGESIZE) {
heap->count++;
heap->pages = (char **)bu_realloc(heap->pages, heap->count *
sizeof(char *), "heap realloc pages[]");
heap->pages[heap->count-1] = (char *)bu_calloc(1, PAGESIZE, "heap
calloc pages[][]");
- heap->used = 0;
+ heap->given = 0;
}
/* give */
- ret = &(heap->pages[heap->count-1][heap->used]);
- heap->used += sz;
+ ret = &(heap->pages[heap->count-1][heap->given]);
+ heap->given += sz;
return (void *)ret;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits