From: Andreas Ă–man Date: Thu, 15 Nov 2012 12:20:07 +0000 (+0100) Subject: Add tvh_strbegins() helper X-Git-Tag: v3.5~290 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99e6f4bd4f63915ddb8ec37ea577332a7a732e49;p=thirdparty%2Ftvheadend.git Add tvh_strbegins() helper --- diff --git a/src/tvheadend.h b/src/tvheadend.h index c07906062..e117f6ab5 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);