Skip to contentSkip to conversation

strv: Add l_strv_eq

PATCH Applied Andrew Zaborowski 3 participants 3 messages Sep 23, 2021 – Mar 4, 2022

lore
Share & tools
lore

Andrew Zaborowski

author
#0 lore raw

PATCH 1/1 strv: Add l_strv_eq

---
 ell/ell.sym |  1 +
 ell/strv.c  | 20 ++++++++++++++++++++
 ell/strv.h  |  1 +
 3 files changed, 22 insertions(+)
ell/ell.sym +1 -0
index 9fcf334..10865af 100644
@@ -40,6 +40,7 @@ global:
 	l_strv_append_printf;
 	l_strv_append_vprintf;
 	l_strv_copy;
+	l_strv_eq;
 	/* utf8 */
 	l_ascii_table;
 	l_utf8_get_codepoint;
ell/strv.c +20 -0
index 3df47be..1343519 100644
@@ -359,3 +359,23 @@ LIB_EXPORT char **l_strv_copy(char **str_array)
 
 	return copy;
 }
+
+/**
+ * l_strv_eq:
+ * @a: a %NULL terminated array of strings or %NULL
+ * @b: another %NULL terminated array of strings or %NULL
+ *
+ * Returns: Whether @a and @b's contents are identical, including the
+ * order, or @a and @b are both %NULL.
+ */
+LIB_EXPORT bool l_strv_eq(char **a, char **b)
+{
+	if (!a || !b)
+		return a == b;
+
+	for (; *a; a++, b++)
+		if (!*b || strcmp(*a, *b))
+			return false;
+
+	return !*b;
+}
ell/strv.h +1 -0
index e673fec..db15cc7 100644
@@ -46,6 +46,7 @@ char **l_strv_append_vprintf(char **str_array, const char *format,
 							va_list args)
 					__attribute__((format(printf, 2, 0)));
 char **l_strv_copy(char **str_array);
+bool l_strv_eq(char **a, char **b);
 
 #ifdef __cplusplus
 }
Signature · 1 line
2.30.2
Applied
#1 lore raw

Hi Andrew,

Quoted 6 lines · Andrew Zaborowski
---
  ell/ell.sym |  1 +
  ell/strv.c  | 20 ++++++++++++++++++++
  ell/strv.h  |  1 +
  3 files changed, 22 insertions(+)

Applied, thanks.

Regards,
-Denis

#2 lore raw

Tamilyogi Proxy Unblock Tamilyogi proxy site List
https://lifetrixcorner.com/tamilyogi-proxy/

ExtraTorrent Proxy Unblock Extratorrent Proxy List of all Sites
https://lifetrixcorner.com/extratorrent-proxy/

ETTV Proxy Unblockit ETTV Proxy & latest Sites
https://lifetrixcorner.com/ettv-proxy/

Torrentz2 Proxy Unblock access Torrentz2 Proxy List
https://lifetrixcorner.com/torrentz2/

isoHunt Proxy Unblock isoHunt Proxy list sites
https://lifetrixcorner.com/isohunt/

MagnetDL Proxy Unblock & MagnetDL Proxy List sites
https://lifetrixcorner.com/magnetdl-proxy/

Demonoid Proxy Unblock Demonoid Proxy Site List
https://lifetrixcorner.com/demonoid/

Write For Us – Submit Guest Post on Lifestyle, Beauty, Travel, Health, Fitness
https://lifetrixcorner.com/write-for-us-guest-post/