[UTC/ITC][dlog][Non-ACR][Fix incorrect va_list use] 53/198153/4
authorMichal Bloch <m.bloch@samsung.com>
Mon, 21 Jan 2019 11:59:13 +0000 (12:59 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Mon, 21 Jan 2019 12:15:24 +0000 (12:15 +0000)
Change-Id: I121d7f27c90b00d39e79c9357cb8c68823d601e5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/itc/dlog/ITs-dlog.c
src/utc/dlog/utc-SystemFW-dlog-vprint-func.c

index 5a10e2fff3469aadf8e9343da42e26effb9b1dbb..9001f819f51822150d01bc65ae119bccec551ead 100755 (executable)
@@ -99,6 +99,17 @@ int ITc_dlog_dlog_print_p(void)
        return 0;
 }
 
+static int dlog_vprint_wrap_va_list(log_priority pri, const char *tag, const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+
+       int ret = dlog_vprint(pri, tag, fmt, ap);
+
+       va_end(ap);
+       return ret;
+}
+
 /**
 * @testcase                    ITc_dlog_dlog_vprint_p
 * @since_tizen                 2.3
@@ -120,7 +131,6 @@ int ITc_dlog_dlog_vprint_p(void)
 {
        START_TEST;
        int nRetVal = -1;
-       va_list vList = {0};
        log_priority earrPriority[MAXENUMSIZE] = {0};
        int nTotalEnums = 0;
        int nEnumCount = 0;
@@ -129,7 +139,7 @@ int ITc_dlog_dlog_vprint_p(void)
        for ( nEnumCount = 0; nEnumCount < nTotalEnums; nEnumCount++ )
        {
                // Target API
-               nRetVal = dlog_vprint(earrPriority[nEnumCount], "DLOG_TEST", "[Dlog_ITC] Dlog Test Message\n", vList);
+               nRetVal = dlog_vprint_wrap_va_list(earrPriority[nEnumCount], "DLOG_TEST", "[Dlog_ITC] Dlog Test Message\n");
                if ( nRetVal < 0 )
                {
                        FPRINTF("[Line : %d][%s] dlog_vprint failed for Enumerator %s\\n", __LINE__, API_NAMESPACE, DlogGetPriorityListValue(earrPriority, &nEnumCount, GETENUM));
index 69f01aa7997360849579ce465e23e882888bee38..c262630f0e36789cf8d2b76056d7103f3b97448f 100755 (executable)
 
 #define LOG_BUF_SIZE 1024
 
+static int dlog_vprint_wrap_va_list(log_priority pri, const char *tag, const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+
+    int ret = dlog_vprint(pri, tag, fmt, ap);
+
+    va_end(ap);
+    return ret;
+}
+
 /**
  * @testcase           utc_SystemFW_dlog_vprint_p
  * @since_tizen                2.3
@@ -30,9 +41,8 @@ int utc_SystemFW_dlog_vprint_p(void)
 {
     int ret = 0;
     char buf[LOG_BUF_SIZE] = "dlog test message for tct-mgr\n";
-    va_list ap;
 
-    ret = dlog_vprint(DLOG_INFO, "DLOG_TEST", buf, ap);
+    ret = dlog_vprint_wrap_va_list(DLOG_INFO, "DLOG_TEST", buf);
 
     assert_gt(ret, 0);
 
@@ -47,9 +57,8 @@ int utc_SystemFW_dlog_vprint_p(void)
 int utc_SystemFW_dlog_vprint_n(void)
 {
     int ret = 0;
-    va_list ap;
 
-    ret = dlog_vprint(-1, NULL, NULL, ap);
+    ret = dlog_vprint_wrap_va_list(-1, NULL, NULL);
 
     assert_lt(ret, 1);