[MPlayer-cvslog] r37491 - in trunk/gui/util: string.c string.h

ib subversion at mplayerhq.hu
Mon Sep 7 10:39:29 CEST 2015


Author: ib
Date: Mon Sep  7 10:39:29 2015
New Revision: 37491

Log:
Add auxiliary function dequote().

Modified:
   trunk/gui/util/string.c
   trunk/gui/util/string.h

Modified: trunk/gui/util/string.c
==============================================================================
--- trunk/gui/util/string.c	Mon Sep  7 10:36:01 2015	(r37490)
+++ trunk/gui/util/string.c	Mon Sep  7 10:39:29 2015	(r37491)
@@ -189,6 +189,29 @@ char *decomment(char *in)
 }
 
 /**
+ * @brief Remove enclosed quotation marks from a string.
+ *
+ * @param in string to be processed
+ *
+ * @return processed string
+ *
+ * @note This is an in-place processing.
+ */
+char *dequote(char *in)
+{
+    if (*in == '"') {
+        size_t end = strlen(in) - 1;
+
+        if (in[end] == '"') {
+            in[end] = 0;
+            in++;
+        }
+    }
+
+    return in;
+}
+
+/**
  * @brief Extract a part of a string delimited by a separator character.
  *
  * @param in string to be analyzed

Modified: trunk/gui/util/string.h
==============================================================================
--- trunk/gui/util/string.h	Mon Sep  7 10:36:01 2015	(r37490)
+++ trunk/gui/util/string.h	Mon Sep  7 10:39:29 2015	(r37491)
@@ -31,6 +31,7 @@
 int cutInt(char *in, char sep, int num);
 void cutString(char *in, char *out, char sep, int num, size_t maxout);
 char *decomment(char *in);
+char *dequote(char *in);
 char *despace(char *in);
 char *gstrchr(const char *str, int c);
 int gstrcmp(const char *a, const char *b);


More information about the MPlayer-cvslog mailing list