summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-06-11 11:48:24 -0400
committerAshod Nakashian <ashnakash@gmail.com>2017-06-12 06:18:31 +0200
commit6de3adcf9ce385152412a7a062245cb751a69cb6 (patch)
tree57c001183059ce494cb465e178b0a85c007300e5 /common
parent42969b732c312215a2955f3b85139a9e7e2fab19 (diff)
wsd: pass default rlimits to forkit from config
Change-Id: I84d271f460f0fb1d03a973107c32265d84bf2841 Reviewed-on: https://gerrit.libreoffice.org/38675 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'common')
-rw-r--r--common/Protocol.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/Protocol.hpp b/common/Protocol.hpp
index cae54d464..e26703d57 100644
--- a/common/Protocol.hpp
+++ b/common/Protocol.hpp
@@ -161,6 +161,21 @@ namespace LOOLProtocol
return std::string(message, size);
}
+ /// Split a string in two at the delimeter, removing it.
+ inline
+ std::pair<std::string, std::string> split(const char* s, const int length, const char delimeter = ' ')
+ {
+ const auto size = getDelimiterPosition(s, length, delimeter);
+ return std::make_pair(std::string(s, size), std::string(s+size+1));
+ }
+
+ /// Split a string in two at the delimeter, removing it.
+ inline
+ std::pair<std::string, std::string> split(const std::string& s, const char delimeter = ' ')
+ {
+ return split(s.c_str(), s.size(), delimeter);
+ }
+
/// Returns the first token of a message.
inline
std::string getFirstToken(const char *message, const int length, const char delim = ' ')