trace: Initialize alloc_list even without os_program_init() call

This makes it somewhat easier to use CONFIG_WPA_TRACE=y build with
external programs that might not be aware of the initialization
requirement, e.g., when linking wpa_ctrl.c with a program that does not
use the os_*() wrappers.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-02-21 17:32:47 +02:00
parent 891dfb3336
commit abae2d1a3c
2 changed files with 3 additions and 4 deletions

View file

@ -17,6 +17,8 @@ struct dl_list {
struct dl_list *prev; struct dl_list *prev;
}; };
#define DL_LIST_HEAD_INIT(l) { &(l), &(l) }
static inline void dl_list_init(struct dl_list *list) static inline void dl_list_init(struct dl_list *list)
{ {
list->next = list; list->next = list;

View file

@ -26,7 +26,7 @@
#include "trace.h" #include "trace.h"
#include "list.h" #include "list.h"
static struct dl_list alloc_list; static struct dl_list alloc_list = DL_LIST_HEAD_INIT(alloc_list);
#define ALLOC_MAGIC 0xa84ef1b2 #define ALLOC_MAGIC 0xa84ef1b2
#define FREED_MAGIC 0x67fd487a #define FREED_MAGIC 0x67fd487a
@ -321,9 +321,6 @@ int os_program_init(void)
capset(&header, &cap); capset(&header, &cap);
#endif /* ANDROID */ #endif /* ANDROID */
#ifdef WPA_TRACE
dl_list_init(&alloc_list);
#endif /* WPA_TRACE */
return 0; return 0;
} }