]> Git Repo - qemu.git/commitdiff
cutils: add qemu_pstrcmp0()
authorMarc-André Lureau <[email protected]>
Fri, 7 Sep 2018 06:44:33 +0000 (10:44 +0400)
committerMarc-André Lureau <[email protected]>
Fri, 5 Oct 2018 12:14:22 +0000 (16:14 +0400)
A char** variant of g_strcmp0().

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
include/qemu/cutils.h
util/cutils.c

index 47aaa3b0b919092ba99389b6dd6a2227cd0088cc..7071bfe2d40e0afe6edf99d1844cdb1b0f6dcdb6 100644 (file)
@@ -169,4 +169,16 @@ bool test_buffer_is_zero_next_accel(void);
 int uleb128_encode_small(uint8_t *out, uint32_t n);
 int uleb128_decode_small(const uint8_t *in, uint32_t *n);
 
+/**
+ * qemu_pstrcmp0:
+ * @str1: a non-NULL pointer to a C string (*str1 can be NULL)
+ * @str2: a non-NULL pointer to a C string (*str2 can be NULL)
+ *
+ * Compares *str1 and *str2 with g_strcmp0().
+ *
+ * Returns: an integer less than, equal to, or greater than zero, if
+ * *str1 is <, == or > than *str2.
+ */
+int qemu_pstrcmp0(const char **str1, const char **str2);
+
 #endif
index 9205e090316642b2e6a53c42863a7d5c129db122..698bd315bdb0f2a3aaae2f55c28a34bcc676582a 100644 (file)
@@ -769,3 +769,8 @@ char *size_to_str(uint64_t val)
 
     return g_strdup_printf("%0.3g %sB", (double)val / div, suffixes[i]);
 }
+
+int qemu_pstrcmp0(const char **str1, const char **str2)
+{
+    return g_strcmp0(*str1, *str2);
+}
This page took 0.027963 seconds and 4 git commands to generate.