]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - stat.c
Merge branch 'master' of github.com:graphitemaster/gmqcc
[xonotic/gmqcc.git] / stat.c
diff --git a/stat.c b/stat.c
index aecd7ebcd9619e81b3d3f5632e7a5a0eccb0eeb0..21447eb39356e33bf00a51e8f99a2cdb93d06c52 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1,3 +1,27 @@
+/*
+ * 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>
@@ -26,12 +50,6 @@ typedef struct {
     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;
@@ -52,7 +70,7 @@ static stat_mem_block_t *stat_mem_block_root        = NULL;
  * 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*)
@@ -505,7 +523,7 @@ static void stat_dump_mem_contents(stat_mem_block_t *memory, uint16_t cols) {
     }
 }
 
-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",
@@ -518,7 +536,7 @@ static void stat_dump_mem_leaks() {
     }
 }
 
-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\
@@ -542,7 +560,7 @@ static void stat_dump_stats_table(stat_size_table_t table, const char *string, u
     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]))