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

ib subversion at mplayerhq.hu
Mon Sep 7 10:36:02 CEST 2015


Author: ib
Date: Mon Sep  7 10:36:01 2015
New Revision: 37490

Log:
Add auxiliary function ltrim().

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:24:53 2015	(r37489)
+++ trunk/gui/util/string.c	Mon Sep  7 10:36:01 2015	(r37490)
@@ -100,6 +100,25 @@ char *strswap(char *in, char from, char
 }
 
 /**
+ * @brief Skip all leading space characters in a string.
+ *
+ * @param in string to be processed
+ *
+ * @return trailing part of @a in starting with the first non-space character
+ */
+const char *ltrim(const char *in)
+{
+    while (*in) {
+        if (*in == ' ')
+            in++;
+        else
+            break;
+    }
+
+    return in;
+}
+
+/**
  * @brief Remove all space characters from a string,
  *        but leave text enclosed in quotation marks untouched.
  *

Modified: trunk/gui/util/string.h
==============================================================================
--- trunk/gui/util/string.h	Mon Sep  7 10:24:53 2015	(r37489)
+++ trunk/gui/util/string.h	Mon Sep  7 10:36:01 2015	(r37490)
@@ -36,6 +36,7 @@ char *gstrchr(const char *str, int c);
 int gstrcmp(const char *a, const char *b);
 char *gstrdup(const char *str);
 int gstrncmp(const char *a, const char *b, size_t n);
+const char *ltrim(const char *in);
 void setddup(char **old, const char *dir, const char *name);
 void setdup(char **old, const char *str);
 char *strlower(char *in);


More information about the MPlayer-cvslog mailing list