Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Feb 2020 17:20:50 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358177 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <202002201720.01KHKodp056244@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Thu Feb 20 17:20:50 2020
New Revision: 358177
URL: https://svnweb.freebsd.org/changeset/base/358177

Log:
  linuxkpi: Add str_has_prefix
  
  This function test if the string str begins with the string pointed
  at by prefix.
  
  Reviewed by:	hselasky
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D23767

Modified:
  head/sys/compat/linuxkpi/common/include/linux/string.h

Modified: head/sys/compat/linuxkpi/common/include/linux/string.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/string.h	Thu Feb 20 17:19:16 2020	(r358176)
+++ head/sys/compat/linuxkpi/common/include/linux/string.h	Thu Feb 20 17:20:50 2020	(r358177)
@@ -154,4 +154,13 @@ memchr_inv(const void *start, int c, size_t length)
 	return (NULL);
 }
 
+static inline size_t
+str_has_prefix(const char *str, const char *prefix)
+{
+	size_t len;
+
+	len = strlen(prefix);
+	return (strncmp(str, prefix, len) == 0 ? len : 0);
+}
+
 #endif					/* _LINUX_STRING_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002201720.01KHKodp056244>