]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
htsmsg: add htsmsg_remove_string_from_list() function
authorJaroslav Kysela <perex@perex.cz>
Fri, 9 Nov 2018 12:30:31 +0000 (13:30 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 9 Nov 2018 12:30:31 +0000 (13:30 +0100)
src/htsmsg.c
src/htsmsg.h

index 735aff7dd3a78cf3a102ff611f9b89d7c35c649a..b45dd929f22e706cb1105176de6ebfb7acc740ee 100644 (file)
@@ -1543,3 +1543,26 @@ htsmsg_is_string_in_list(htsmsg_t *list, const char *str)
   }
   return 0;
 }
+
+/*
+ *
+ */
+int
+htsmsg_remove_string_from_list(htsmsg_t *list, const char *str)
+{
+  const char *s;
+  htsmsg_field_t *f;
+
+  if (list == NULL || !list->hm_islist)
+    return 0;
+  HTSMSG_FOREACH(f, list) {
+    s = htsmsg_field_get_str(f);
+    if (s == NULL)
+      continue;
+    if (!strcasecmp(s, str)) {
+      htsmsg_field_destroy(list, f);
+      return 1;
+    }
+  }
+  return 0;
+}
index e9dd2a8c523c084f879b905a632606ca617a3423..5cdcaa48670373fb609b04e72f0ea8d75495a480 100644 (file)
@@ -512,6 +512,8 @@ htsmsg_t *htsmsg_create_key_val(const char *key, const char *val);
 
 int htsmsg_is_string_in_list(htsmsg_t *list, const char *str);
 
+int htsmsg_remove_string_from_list(htsmsg_t *list, const char *str);
+
 /**
  *
  */