gchar hostname[100];
g_tmp_dir = g_strdup (g_getenv ("TMPDIR"));
+
if (g_tmp_dir == NULL || *g_tmp_dir == '\0')
- g_tmp_dir = g_strdup (g_getenv ("TMP"));
+ {
+ g_free (g_tmp_dir);
+ g_tmp_dir = g_strdup (g_getenv ("TMP"));
+ }
+
if (g_tmp_dir == NULL || *g_tmp_dir == '\0')
- g_tmp_dir = g_strdup (g_getenv ("TEMP"));
+ {
+ g_free (g_tmp_dir);
+ g_tmp_dir = g_strdup (g_getenv ("TEMP"));
+ }
#ifdef G_OS_WIN32
if (g_tmp_dir == NULL || *g_tmp_dir == '\0')
- g_tmp_dir = get_windows_directory_root ();
-#else
+ {
+ g_free (g_tmp_dir);
+ g_tmp_dir = get_windows_directory_root ();
+ }
+#else
+
#ifdef P_tmpdir
if (g_tmp_dir == NULL || *g_tmp_dir == '\0')
{
- gsize k;
+ gsize k;
+ g_free (g_tmp_dir);
g_tmp_dir = g_strdup (P_tmpdir);
k = strlen (g_tmp_dir);
if (k > 1 && G_IS_DIR_SEPARATOR (g_tmp_dir[k - 1]))
if (g_tmp_dir == NULL || *g_tmp_dir == '\0')
{
- g_tmp_dir = g_strdup ("/tmp");
+ g_free (g_tmp_dir);
+ g_tmp_dir = g_strdup (g_getenv ("/tmp"));
}
#endif /* !G_OS_WIN32 */
GIOStatus status;
guchar buf[512];
gsize read_bytes = 0;
-
+
g_assert_cmpuint (condition, ==, G_IO_IN);
for (status = g_io_channel_read_chars (channel, (gchar*)buf, sizeof (buf), &read_bytes, NULL);
default:
g_error ("unexpected log message type: %s", g_test_log_type_name (msg->log_type));
}
+ g_test_log_msg_free (msg);
}
g_assert_cmpint (passed, ==, 3);
g_free (argv[1]);
g_main_loop_unref (loop);
+ g_test_log_buffer_free (tlb);
}
static void
default:
g_error ("unexpected log message type: %s", g_test_log_type_name (msg->log_type));
}
+ g_test_log_msg_free (msg);
}
g_free (argv[1]);
g_main_loop_unref (loop);
+ g_test_log_buffer_free (tlb);
}
g_assert_cmpint (messages, ==, 3);
g_strrstr_len (string, 4096, ".");
g_strrstr_len (string, 4096, "");
- g_ascii_strdown (string, 4096);
- g_ascii_strdown (string, 4096);
- g_ascii_strup (string, 4096);
- g_ascii_strup (string, 4096);
+ tmp = g_ascii_strup (string, 4096);
+ tmp2 = g_ascii_strup (tmp, 4096);
+ g_assert_cmpint (g_ascii_strncasecmp (string, tmp, 4096), ==, 0);
+ g_assert_cmpint (g_ascii_strncasecmp (string, tmp2, 4096), ==, 0);
+ g_assert_cmpint (g_ascii_strncasecmp (tmp, tmp2, 4096), ==, 0);
+ g_free (tmp);
+ g_free (tmp2);
- g_ascii_strncasecmp (string, string, 4096);
+ tmp = g_ascii_strdown (string, 4096);
+ tmp2 = g_ascii_strdown (tmp, 4096);
+ g_assert_cmpint (g_ascii_strncasecmp (string, tmp, 4096), ==, 0);
+ g_assert_cmpint (g_ascii_strncasecmp (string, tmp2, 4096), ==, 0);
+ g_assert_cmpint (g_ascii_strncasecmp (tmp, tmp2, 4096), ==, 0);
+ g_free (tmp);
+ g_free (tmp2);
tmp = g_markup_escape_text (string, 4096);
g_free (tmp);
g_assert_cmpint (strlen (tmp), ==, 4095 + 2);
g_free (tmp);
- g_ascii_strdown (string, -1);
- g_ascii_strdown (string, -1);
- g_ascii_strup (string, -1);
- g_ascii_strup (string, -1);
+ tmp = g_ascii_strdown (string, -1);
+ tmp2 = g_ascii_strdown (tmp, -1);
+ g_assert_cmpint (strlen(tmp), ==, strlen(tmp2));
+ g_assert_cmpint (strlen(string), ==, strlen(tmp));
+ g_assert_cmpint (g_ascii_strncasecmp (string, tmp, -1), ==, 0);
+ g_assert_cmpint (g_ascii_strncasecmp (string, tmp2, -1), ==, 0);
+ g_assert_cmpint (g_ascii_strncasecmp (tmp, tmp2, -1), ==, 0);
+ g_free (tmp);
+ g_free (tmp2);
+
+ tmp = g_ascii_strup (string, -1);
+ tmp2 = g_ascii_strup (string, -1);
+ g_assert_cmpint (strlen(tmp), ==, strlen(tmp2));
+ g_assert_cmpint (strlen(string), ==, strlen(tmp));
+ g_assert_cmpint (g_ascii_strncasecmp (string, tmp, -1), ==, 0);
+ g_assert_cmpint (g_ascii_strncasecmp (string, tmp2, -1), ==, 0);
+ g_assert_cmpint (g_ascii_strncasecmp (tmp, tmp2, -1), ==, 0);
+ g_free (tmp);
+ g_free (tmp2);
g_ascii_strcasecmp (string, string);
g_ascii_strncasecmp (string, string, 10000);