summaryrefslogtreecommitdiff
path: root/src/VBox/Runtime/common/string/RTStrEnd.cpp
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2020-04-21 11:14:20 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2020-04-21 11:14:20 +0000
commitf7ffc72d85f5b9869fc46bbd9351c48883d78ac9 (patch)
tree9269c04b4a42ba7920435c2f40abe126c185f972 /src/VBox/Runtime/common/string/RTStrEnd.cpp
parent2c25166e8f436f0115dc78dd0245761d07b0f07c (diff)
downloadVirtualBox-svn-f7ffc72d85f5b9869fc46bbd9351c48883d78ac9.tar.gz
IPRT: Implement RTStrEnd in assembly & C++, drop the inlining. memchr from VC++ 14.1 cannot deal wtih RTSTR_MAX on unaligned string, it may step into an electric fence page after the end of the string. bugref:8489
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@83886 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Runtime/common/string/RTStrEnd.cpp')
-rw-r--r--src/VBox/Runtime/common/string/RTStrEnd.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/VBox/Runtime/common/string/RTStrEnd.cpp b/src/VBox/Runtime/common/string/RTStrEnd.cpp
new file mode 100644
index 00000000000..7d74f90c5f7
--- /dev/null
+++ b/src/VBox/Runtime/common/string/RTStrEnd.cpp
@@ -0,0 +1,46 @@
+/* $Id$ */
+/** @file
+ * IPRT - RTStrEnd, C++ version.
+ */
+
+/*
+ * Copyright (C) 2006-2020 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*********************************************************************************************************************************
+* Header Files *
+*********************************************************************************************************************************/
+#include <iprt/string.h>
+
+
+RTDECL(char *) RTStrEnd(const char *pszString, size_t cchMax)
+{
+ while (cchMax-- > 0)
+ {
+ if (*pszString)
+ { }
+ else
+ return pszString;
+ pszString++;
+ }
+ return NULL;
+}
+RT_EXPORT_SYMBOL(RTStrEnd);