+/*
+ * Copyright (C) 2012, 2013
+ * Dale Weiler
+ * Wolfgang Bumiller
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
size_t value;
} stat_size_entry_t, **stat_size_table_t;
-typedef struct {
- uint64_t used;
- uint64_t type;
- uint64_t size;
-} stat_entry_t;
-
static uint64_t stat_mem_allocated = 0;
static uint64_t stat_mem_deallocated = 0;
static uint64_t stat_mem_allocated_total = 0;
* sizes. We can use it for other things too, if we need to. This is
* very TIGHT, and efficent in terms of space though.
*/
-static stat_size_table_t stat_size_new() {
+static stat_size_table_t stat_size_new(void) {
return (stat_size_table_t)memset(
mem_a(sizeof(stat_size_entry_t*) * ST_SIZE),
0, ST_SIZE * sizeof(stat_size_entry_t*)
}
}
-static void stat_dump_mem_leaks() {
+static void stat_dump_mem_leaks(void) {
stat_mem_block_t *info;
for (info = stat_mem_block_root; info; info = info->next) {
con_out("lost: %u (bytes) at %s:%u\n",
}
}
-static void stat_dump_mem_info() {
+static void stat_dump_mem_info(void) {
con_out("Memory information:\n\
Total allocations: %llu\n\
Total deallocations: %llu\n\
if (!table)
return;
- for (i = 0, j = 0; i < ST_SIZE; i++) {
+ for (i = 0, j = 1; i < ST_SIZE; i++) {
stat_size_entry_t *entry;
if (!(entry = table[i]))