You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2023/07/13 21:22:21 UTC

[nuttx] 04/04: syslog: replace lib_sprintf to lib_sprintf_internal

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

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

commit 6a0ffa5c52f51f8a4ad3d89ab7a0d73633bab482
Author: yinshengkai <yi...@xiaomi.com>
AuthorDate: Sun Jun 25 12:36:29 2023 +0800

    syslog: replace lib_sprintf to lib_sprintf_internal
    
    Signed-off-by: yinshengkai <yi...@xiaomi.com>
---
 drivers/syslog/vsyslog.c | 43 ++++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/drivers/syslog/vsyslog.c b/drivers/syslog/vsyslog.c
index fa5163bb8a..39ed721d8a 100644
--- a/drivers/syslog/vsyslog.c
+++ b/drivers/syslog/vsyslog.c
@@ -150,101 +150,102 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
     defined(CONFIG_SYSLOG_PRIORITY) || defined(CONFIG_SYSLOG_PREFIX) || \
     defined(CONFIG_SYSLOG_PROCESS_NAME)
 
-  ret = lib_sprintf(&stream.public,
+  ret = lib_sprintf_internal(&stream.public,
 #if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
   /* Reset the terminal style. */
 
-                    "\e[0m"
+                             "\e[0m"
 #endif
 
 #ifdef CONFIG_SYSLOG_TIMESTAMP
 #  if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
 #    if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
-                    "[%s.%06ld] "
+                             "[%s.%06ld] "
 #    else
-                    "[%s] "
+                             "[%s] "
 #    endif
 #  else
-                    "[%5jd.%06ld] "
+                             "[%5jd.%06ld] "
 #  endif
 #endif
 
 #if defined(CONFIG_SMP)
-                    "[CPU%d] "
+                             "[CPU%d] "
 #endif
 
 #if defined(CONFIG_SYSLOG_PROCESSID)
   /* Prepend the Thread ID */
 
-                    "[%2d] "
+                             "[%2d] "
 #endif
 
 #if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
   /* Set the terminal style according to message priority. */
 
-                    "%s"
+                             "%s"
 #endif
 
 #if defined(CONFIG_SYSLOG_PRIORITY)
   /* Prepend the message priority. */
 
-                    "[%6s] "
+                             "[%6s] "
 #endif
 
 #if defined(CONFIG_SYSLOG_PREFIX)
   /* Prepend the prefix, if available */
 
-                    "[%s] "
+                             "[%s] "
 #endif
 #if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
   /* Prepend the thread name */
 
-                    "%s: "
+                             "%s: "
 #endif
 #ifdef CONFIG_SYSLOG_TIMESTAMP
 #  if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
 #    if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
-                    , date_buf, ts.tv_nsec / NSEC_PER_USEC
+                             , date_buf, ts.tv_nsec / NSEC_PER_USEC
 #    else
-                    , date_buf
+                             , date_buf
 #    endif
 #  else
-                    , (uintmax_t)ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC
+                             , (uintmax_t)ts.tv_sec
+                             , ts.tv_nsec / NSEC_PER_USEC
 #  endif
 #endif
 
 #if defined(CONFIG_SMP)
-                    , up_cpu_index()
+                             , up_cpu_index()
 #endif
 
 #if defined(CONFIG_SYSLOG_PROCESSID)
   /* Prepend the Thread ID */
 
-                    , nxsched_gettid()
+                             , nxsched_gettid()
 #endif
 
 #if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
   /* Set the terminal style according to message priority. */
 
-                    , g_priority_color[priority]
+                             , g_priority_color[priority]
 #endif
 
 #if defined(CONFIG_SYSLOG_PRIORITY)
   /* Prepend the message priority. */
 
-                    , g_priority_str[priority]
+                             , g_priority_str[priority]
 #endif
 
 #if defined(CONFIG_SYSLOG_PREFIX)
   /* Prepend the prefix, if available */
 
-                    , CONFIG_SYSLOG_PREFIX_STRING
+                             , CONFIG_SYSLOG_PREFIX_STRING
 #endif
 
 #if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
   /* Prepend the thread name */
 
-                    , tcb != NULL ? tcb->name : "(null)"
+                             , tcb != NULL ? tcb->name : "(null)"
 #endif
                     );
 
@@ -252,7 +253,7 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
 
   /* Generate the output */
 
-  ret += lib_vsprintf(&stream.public, fmt, *ap);
+  ret += lib_vsprintf_internal(&stream.public, fmt, *ap);
 
   if (stream.last_ch != '\n')
     {