4 * Functions and macros widely used in the tests.
7 //same as strcmp() == 0 but works properly for NULL pointers
8 gboolean my_strcmp(const gchar* str1, const gchar* str2)
10 if(str1 == str2) return TRUE;
11 if(str1 == NULL || str2 == NULL) return FALSE;
13 return strcmp(str1,str2) == 0;
15 //same as strlen but works properly for NULL pointer and returns gint instead of guint
16 gint my_strlen(const gchar* str)
18 if(str == NULL)return 0;
19 return (gint)strlen(str);
21 //same as strncmp() == 0 but works properly for NULL pointers
22 gboolean my_strncmp(const gchar* str1, const gchar* str2, gint n)
24 if(n <= 0)return TRUE;
25 if(str1 == str2)return TRUE;
26 if(str1 == NULL || str2 == NULL)return FALSE;
28 return strncmp(str1, str2, n) == 0;