diff --git a/pxr/usd/sdf/pathParser.cpp b/pxr/usd/sdf/pathParser.cpp index 409ed55451..45813c4a9a 100644 --- a/pxr/usd/sdf/pathParser.cpp +++ b/pxr/usd/sdf/pathParser.cpp @@ -30,6 +30,11 @@ using namespace PXR_PEGTL_NAMESPACE; namespace Sdf_PathParser { +template +TfToken GetToken(Input const &in) { + return TfToken{in.string_view()}; +} + template <> struct Action { template diff --git a/pxr/usd/sdf/pathParser.h b/pxr/usd/sdf/pathParser.h index 95b743fee3..8635586121 100644 --- a/pxr/usd/sdf/pathParser.h +++ b/pxr/usd/sdf/pathParser.h @@ -216,25 +216,6 @@ struct PPContext { std::string varName; }; -template -TfToken GetToken(Input const &in) { - constexpr int BufSz = 32; - char buf[BufSz]; - size_t strSize = std::distance(in.begin(), in.end()); - TfToken tok; - if (strSize < BufSz) { - // copy & null-terminate. - std::copy(in.begin(), in.end(), buf); - buf[strSize] = '\0'; - tok = TfToken(buf); - } - else { - // fall back to string path. - tok = TfToken(in.string()); - } - return tok; -} - template struct Action : PEGTL_NS::nothing {};