make the 'name' and 'value' fields in ast_variable const char *
[asterisk/asterisk.git] / main / threadstorage.c
index de3e9e0..a03f3c9 100644 (file)
@@ -56,7 +56,7 @@ void __ast_threadstorage_object_add(void *key, size_t len, const char *file, con
 {
        struct tls_object *to;
 
-       if (!(to = ast_calloc(sizeof(*to), 1)))
+       if (!(to = ast_calloc(1, sizeof(*to))))
                return;
 
        to->key = key;
@@ -78,7 +78,7 @@ void __ast_threadstorage_object_remove(void *key)
        AST_RWLIST_WRLOCK(&tls_objects);
        AST_LIST_TRAVERSE_SAFE_BEGIN(&tls_objects, to, entry) {
                if (to->key == key) {
-                       AST_LIST_REMOVE_CURRENT(&tls_objects, entry);
+                       AST_LIST_REMOVE_CURRENT(entry);
                        break;
                }
        }
@@ -160,6 +160,7 @@ static char *handle_cli_threadstorage_show_summary(struct ast_cli_entry *e, int
                unsigned int count;
                AST_LIST_ENTRY(file) entry;
        } *file;
+       AST_LIST_HEAD_NOLOCK_STATIC(file_summary, file);
 
        switch (cmd) {
        case CLI_INIT:
@@ -176,8 +177,6 @@ static char *handle_cli_threadstorage_show_summary(struct ast_cli_entry *e, int
        if (a->argc > 4)
                return CLI_SHOWUSAGE;
 
-       AST_LIST_HEAD_NOLOCK_STATIC(file_summary, file);
-
        if (a->argc > 3)
                fn = a->argv[3];
 
@@ -223,8 +222,8 @@ static char *handle_cli_threadstorage_show_summary(struct ast_cli_entry *e, int
 }
 
 static struct ast_cli_entry cli[] = {
-       NEW_CLI(handle_cli_threadstorage_show_allocations, "Display outstanding thread local storage allocations"),
-       NEW_CLI(handle_cli_threadstorage_show_summary,     "Summarize outstanding memory allocations")
+       AST_CLI_DEFINE(handle_cli_threadstorage_show_allocations, "Display outstanding thread local storage allocations"),
+       AST_CLI_DEFINE(handle_cli_threadstorage_show_summary,     "Summarize outstanding memory allocations")
 };
 
 void threadstorage_init(void)