Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151055016
D49374.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
709 B
Referenced Files
None
Subscribers
None
D49374.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -161,6 +161,24 @@
return (__DECONST(char *, str));
}
+/*
+ * This function trims whitespaces at the end of a string and returns a pointer
+ * to the first non-whitespace character.
+ */
+static inline char *
+strim(char *str)
+{
+ char *end;
+
+ end = str + strlen(str);
+ while (end >= str && (*end == '\0' || isspace(*end))) {
+ *end = '\0';
+ end--;
+ }
+
+ return (skip_spaces(str));
+}
+
static inline void *
memchr_inv(const void *start, int c, size_t length)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 6, 4:46 PM (2 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30985850
Default Alt Text
D49374.diff (709 B)
Attached To
Mode
D49374: linuxkpi: Add `strim()`
Attached
Detach File
Event Timeline
Log In to Comment