From 99e6f4bd4f63915ddb8ec37ea577332a7a732e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Thu, 15 Nov 2012 13:20:07 +0100 Subject: [PATCH] Add tvh_strbegins() helper --- src/tvheadend.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tvheadend.h b/src/tvheadend.h index c0790606..e117f6ab 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -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);