This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new b1e658324 wireless/wapi:rework wapi error print in util.h
b1e658324 is described below

commit b1e6583246710c779d7f8d975dabdf0b77557155
Author: 田昕 <[email protected]>
AuthorDate: Fri Jan 13 11:57:10 2023 +0800

    wireless/wapi:rework wapi error print in util.h
    
    Signed-off-by: 田昕 <[email protected]>
---
 wireless/wapi/src/util.h | 74 +++++++++++-------------------------------------
 1 file changed, 17 insertions(+), 57 deletions(-)

diff --git a/wireless/wapi/src/util.h b/wireless/wapi/src/util.h
index b5b1e49bf..56a513ab7 100644
--- a/wireless/wapi/src/util.h
+++ b/wireless/wapi/src/util.h
@@ -42,74 +42,34 @@
  ****************************************************************************/
 
 #include <string.h>
+#include <debug.h>
 #include <errno.h>
 
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
 
-#ifdef DEBUG_WIRELESS_ERROR
-#  ifdef CONFIG_LIBC_STRERROR
-#    define WAPI_IOCTL_STRERROR(cmd,errcode) \
-      fprintf( \
-        stderr, "%s:%d:%s():ioctl(%s): %s\n", \
-        __FILE__, __LINE__, __func__, \
-        wapi_ioctl_command_name(cmd), strerror(errcode))
-
-#    define WAPI_STRERROR(fmt, ...) \
-      fprintf( \
-          stderr, "%s:%d:%s():" fmt ": %s\n", \
-        __FILE__, __LINE__, __func__, \
-        ## __VA_ARGS__, strerror(errno))
-#  else
-#    define WAPI_IOCTL_STRERROR(cmd,errcode) \
-      fprintf( \
-        stderr, "%s:%d:%s():ioctl(%s): %d\n", \
-        __FILE__, __LINE__, __func__, \
-        wapi_ioctl_command_name(cmd), errcode)
-
-#    define WAPI_STRERROR(fmt, ...) \
-      fprintf( \
-          stderr, "%s:%d:%s():" fmt ": %d\n", \
-        __FILE__, __LINE__, __func__, \
-        ## __VA_ARGS__, errno)
-#  endif
-
-#  define WAPI_ERROR(fmt, ...) \
-    fprintf( \
-      stderr, "%s:%d:%s(): " fmt , \
-      __FILE__, __LINE__, __func__, ## __VA_ARGS__)
+#ifdef CONFIG_LIBC_STRERROR
+#  define WAPI_IOCTL_STRERROR(cmd,errcode) \
+    wlerr("ioctl(%s): %s\n", \
+      wapi_ioctl_command_name(cmd), strerror(errcode))
 
+#  define WAPI_STRERROR(fmt, ...) \
+    wlerr(fmt ": %s\n", \
+      ## __VA_ARGS__, strerror(errno))
 #else
-#  ifdef CONFIG_LIBC_STRERROR
-#    define WAPI_IOCTL_STRERROR(cmd,errcode) \
-      fprintf( \
-        stderr, "ioctl(%s): %s\n", \
-        wapi_ioctl_command_name(cmd), strerror(errcode))
-
-#    define WAPI_STRERROR(fmt, ...) \
-      fprintf( \
-        stderr, fmt ": %s\n", \
-        ## __VA_ARGS__, strerror(errno))
-#  else
-#    define WAPI_IOCTL_STRERROR(cmd,errcode) \
-      fprintf( \
-        stderr, "ioctl(%s): %d\n", \
-        wapi_ioctl_command_name(cmd), errcode)
-
-#    define WAPI_STRERROR(fmt, ...) \
-      fprintf( \
-        stderr, fmt ": %d\n", \
-        ## __VA_ARGS__, errno)
-#  endif
-
-#  define WAPI_ERROR(fmt, ...) \
-    fprintf( \
-      stderr, fmt , \
-      ## __VA_ARGS__)
+#  define WAPI_IOCTL_STRERROR(cmd,errcode) \
+    wlerr("ioctl(%s): %d\n", \
+      wapi_ioctl_command_name(cmd), errcode)
 
+#  define WAPI_STRERROR(fmt, ...) \
+    wlerr(fmt ": %d\n", \
+      ## __VA_ARGS__, errno)
 #endif
 
+#define WAPI_ERROR(fmt, ...) \
+  wlerr(fmt , ## __VA_ARGS__)
+
 #define WAPI_VALIDATE_PTR(ptr) \
   if (ptr == NULL) \
     { \

Reply via email to