Permalink
Browse files

wpa_supplicant: Remove unnecessary messages.

1. Remove MSG_MSGDUMP/MSG_DEBUG calls.
2. Remove calls to dump data to stdout.
3. Turn off log-to-file support.

This saves 64 kilobytes.
  • Loading branch information...
1 parent 8b41a26 commit 5f0106824621dbd0c47169af8a1f3f6fbe27a837 Chia-chi Yeh committed Aug 5, 2009
Showing with 47 additions and 19 deletions.
  1. +1 −1 .config
  2. +24 −18 common.c
  3. +22 −0 common.h
View
2 .config
@@ -33,5 +33,5 @@ CONFIG_DRIVER_WEXT=y
# CONFIG_DRIVER_NDIS=y
# CONFIG_DRIVER_TEST=y
# CONFIG_DRIVER_CUSTOM=y
-CONFIG_DEBUG_FILE=y
+# CONFIG_DEBUG_FILE=y
# CONFIG_INTERNAL_LIBTOMMATH=y
View
42 common.c
@@ -16,10 +16,6 @@
#include "common.h"
-#ifdef ANDROID
-#include <cutils/log.h>
-#endif
-
#ifdef CONFIG_DEBUG_FILE
static FILE *out_file = NULL;
@@ -144,7 +140,30 @@ void wpa_get_ntp_timestamp(u8 *buf)
os_memcpy(buf + 4, (u8 *) &usec, 4);
}
+#ifdef ANDROID
+
+#include <android/log.h>
+
+void android_printf(int level, char *format, ...)
+{
+ if (level >= wpa_debug_level) {
+ va_list ap;
+ if (level == MSG_ERROR) {
+ level = ANDROID_LOG_ERROR;
+ } else if (level == MSG_WARNING) {
+ level = ANDROID_LOG_WARN;
+ } else if (level == MSG_INFO) {
+ level = ANDROID_LOG_INFO;
+ } else {
+ level = ANDROID_LOG_DEBUG;
+ }
+ va_start(ap, format);
+ __android_log_vprint(level, "wpa_supplicant", format, ap);
+ va_end(ap);
+ }
+}
+#else /* ANDROID */
#ifndef CONFIG_NO_STDOUT_DEBUG
@@ -195,20 +214,6 @@ void wpa_printf(int level, char *fmt, ...)
#ifdef CONFIG_DEBUG_FILE
}
#endif /* CONFIG_DEBUG_FILE */
-#ifdef ANDROID
- if (level == MSG_DEBUG)
- level = ANDROID_LOG_DEBUG;
- else if (level == MSG_INFO)
- level = ANDROID_LOG_INFO;
- else if (level == MSG_WARNING)
- level = ANDROID_LOG_WARN;
- else if (level == MSG_ERROR)
- level = ANDROID_LOG_ERROR;
- else
- level = ANDROID_LOG_DEBUG;
-
- LOG_PRI_VA(level, "wpa_supplicant", fmt, ap);
-#endif
}
va_end(ap);
}
@@ -392,6 +397,7 @@ void wpa_debug_close_file(void)
#endif /* CONFIG_NO_STDOUT_DEBUG */
+#endif /* ANDROID */
#ifndef CONFIG_NO_WPA_MSG
static wpa_msg_cb_func wpa_msg_cb = NULL;
View
22 common.h
@@ -256,6 +256,27 @@ void wpa_get_ntp_timestamp(u8 *buf);
enum { MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR };
+#ifdef ANDROID
+
+#define wpa_debug_print_timestamp() do {} while (0)
+#define wpa_hexdump(...) do {} while (0)
+#define wpa_hexdump_key(...) do {} while (0)
+#define wpa_hexdump_ascii(...) do {} while (0)
+#define wpa_hexdump_ascii_key(...) do {} while (0)
+#define wpa_debug_open_file(...) do {} while (0)
+#define wpa_debug_close_file() do {} while (0)
+
+void android_printf(int level, char *format, ...);
+
+#define wpa_printf(level, ...) \
+ do { \
+ if ((level) >= MSG_INFO) { \
+ android_printf((level), __VA_ARGS__); \
+ } \
+ } while (0)
+
+#else /* ANDROID */
+
#ifdef CONFIG_NO_STDOUT_DEBUG
#define wpa_debug_print_timestamp() do { } while (0)
@@ -358,6 +379,7 @@ void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf,
#endif /* CONFIG_NO_STDOUT_DEBUG */
+#endif /* ANDROID */
#ifdef CONFIG_NO_WPA_MSG
#define wpa_msg(args...) do { } while (0)

0 comments on commit 5f01068

Please sign in to comment.