[MPlayer-cvslog] r37508 - in branches/1.2: . gui/util/string.c gui/util/string.h

ib subversion at mplayerhq.hu
Tue Sep 8 23:02:10 CEST 2015


Author: ib
Date: Tue Sep  8 23:02:10 2015
New Revision: 37508

Log:
Merge r37491 from trunk:

Add auxiliary function dequote().

Modified:
   branches/1.2/   (props changed)
   branches/1.2/gui/util/string.c
   branches/1.2/gui/util/string.h

Modified: branches/1.2/gui/util/string.c
==============================================================================
--- branches/1.2/gui/util/string.c	Tue Sep  8 23:02:07 2015	(r37507)
+++ branches/1.2/gui/util/string.c	Tue Sep  8 23:02:10 2015	(r37508)
@@ -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: branches/1.2/gui/util/string.h
==============================================================================
--- branches/1.2/gui/util/string.h	Tue Sep  8 23:02:07 2015	(r37507)
+++ branches/1.2/gui/util/string.h	Tue Sep  8 23:02:10 2015	(r37508)
@@ -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