From ccdd4ffda70a35219fae1cdce1306f3d4ebd8dc9 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 18 Nov 2016 15:49:28 -0800 Subject: Move split() to OSUtils since it is not used in core. --- node/Utils.cpp | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'node/Utils.cpp') diff --git a/node/Utils.cpp b/node/Utils.cpp index 9d67fc22..215e3b3e 100644 --- a/node/Utils.cpp +++ b/node/Utils.cpp @@ -218,50 +218,6 @@ void Utils::getSecureRandom(void *buf,unsigned int bytes) s20.encrypt12(buf,buf,bytes); } -std::vector Utils::split(const char *s,const char *const sep,const char *esc,const char *quot) -{ - std::vector fields; - std::string buf; - - if (!esc) - esc = ""; - if (!quot) - quot = ""; - - bool escapeState = false; - char quoteState = 0; - while (*s) { - if (escapeState) { - escapeState = false; - buf.push_back(*s); - } else if (quoteState) { - if (*s == quoteState) { - quoteState = 0; - fields.push_back(buf); - buf.clear(); - } else buf.push_back(*s); - } else { - const char *quotTmp; - if (strchr(esc,*s)) - escapeState = true; - else if ((buf.size() <= 0)&&((quotTmp = strchr(quot,*s)))) - quoteState = *quotTmp; - else if (strchr(sep,*s)) { - if (buf.size() > 0) { - fields.push_back(buf); - buf.clear(); - } // else skip runs of seperators - } else buf.push_back(*s); - } - ++s; - } - - if (buf.size()) - fields.push_back(buf); - - return fields; -} - bool Utils::scopy(char *dest,unsigned int len,const char *src) { if (!len) -- cgit v1.2.3