]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add tvh_strbegins() helper
authorAndreas Öman <andreas@lonelycoder.com>
Thu, 15 Nov 2012 12:20:07 +0000 (13:20 +0100)
committerAndreas Öman <andreas@lonelycoder.com>
Thu, 15 Nov 2012 12:20:52 +0000 (13:20 +0100)
src/tvheadend.h

index c079060620e3acd0b89cfd1afa70c3fa06db6a52..e117f6ab5b19b0d1152c99c311b06d8680442fff 100644 (file)
@@ -432,6 +432,14 @@ extern void scopedunlock(pthread_mutex_t **mtxp);
 #define tvh_strlcatf(buf, size, fmt...) \
  snprintf((buf) + strlen(buf), (size) - strlen(buf), fmt)
 
+static inline const char *tvh_strbegins(const char *s1, const char *s2)
+{
+  while(*s2)
+    if(*s1++ != *s2++)
+      return NULL;
+  return s1;
+}
+
 int tvh_open(const char *pathname, int flags, mode_t mode);
 
 int tvh_socket(int domain, int type, int protocol);