From 64d770474f83c8e353dbd5f30ca328f8a3045fb2 Mon Sep 17 00:00:00 2001 From: q66 Date: Tue, 11 Aug 2015 01:39:25 +0100 Subject: [PATCH] use the new algo stuff --- cubescript.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cubescript.cc b/cubescript.cc index a3cf2e2..c8e7c7a 100644 --- a/cubescript.cc +++ b/cubescript.cc @@ -1431,10 +1431,10 @@ static bool compileblockstr(GenState &gs, ostd::ConstCharRange str, bool macro) char *buf = (char *)&gs.code[gs.code.size()]; int len = 0; while (!str.empty()) { - int n = strcspn(str.data(), "\r/\"@]\0"); - memcpy(&buf[len], str.data(), n); - len += n; - str.pop_front_n(n); + const char *p = str.data(); + str = ostd::find_one_of(str, ostd::ConstCharRange("\r/\"@]")); + memcpy(&buf[len], p, str.data() - p); + len += str.data() - p; if (str.empty()) goto done; switch (str.front()) { @@ -1451,7 +1451,8 @@ static bool compileblockstr(GenState &gs, ostd::ConstCharRange str, bool macro) break; } case '/': - if (str[1] == '/') str.pop_front_n(strcspn(str.data(), "\n\0")); + if (str[1] == '/') + str = ostd::find(str, '\n'); else { buf[len++] = str.front(); str.pop_front();