[gtksourceview/meson.msvc: 6/8] test-int2str.c: Use g_snprintf()



commit 34621c6023fc07526433a9c7ca60b9493d8b6347
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Apr 24 16:32:09 2019 +0800

    test-int2str.c: Use g_snprintf()
    
    snprintf() is not available on all platforms, and may work differently
    depending on the CRT implementation.  Use the g_snprintf() from GLib
    instead, since this is already GLib-using code.

 tests/test-int2str.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tests/test-int2str.c b/tests/test-int2str.c
index 2cf82147..9dec0f44 100644
--- a/tests/test-int2str.c
+++ b/tests/test-int2str.c
@@ -44,10 +44,10 @@ main (gint   argc,
        {
                gchar tmpbuf[12];
 
-               snprintf (tmpbuf, 12, "%u", i);
+               g_snprintf (tmpbuf, 12, "%u", i);
        }
        d = g_timer_elapsed (timer, NULL);
-       g_print ("     snprintf: %lf\n", d);
+       g_print ("     g_snprintf: %lf\n", d);
 
        /* Make sure implementation is correct */
        for (i = 0; i < 20000; i++)
@@ -57,7 +57,7 @@ main (gint   argc,
                gchar str2[12];
 
                len1 = _gtk_source_utils_int_to_string (i, &str1);
-               len2 = snprintf (str2, sizeof str2, "%u", i);
+               len2 = g_snprintf (str2, sizeof str2, "%u", i);
 
                g_assert_cmpint (len1, ==, len2);
                g_assert_cmpstr (str1, ==, str2);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]