diff --git a/dw/hyphenator.cc b/dw/hyphenator.cc index 06d892d..e64b673 100644 --- a/dw/hyphenator.cc +++ b/dw/hyphenator.cc @@ -120,22 +120,15 @@ Hyphenator *Hyphenator::getHyphenator (const char *lang) if (hyphenator) delete langString; else { - int patFileLen = strlen (DILLO_LIBDIR) + 13 + strlen (lang) + 4 + 1; - char *patFile = new char[patFileLen]; - snprintf (patFile, patFileLen, "%s/hyphenation/%s.pat", - DILLO_LIBDIR, lang); - int excFileLen = strlen (DILLO_LIBDIR) + 13 + strlen (lang) + 4 + 1; - char *excFile = new char[excFileLen]; - snprintf (excFile, excFileLen, "%s/hyphenation/%s.exc", - DILLO_LIBDIR, lang); + using namespace std::literals::string_literals; + std::string patFile= DILLO_LIBDIR + "/hyphenation/"s + lang + ".pat"; + std::string excFile= DILLO_LIBDIR + "/hyphenation"s + lang + ".exc"; //printf ("Loading hyphenation patterns for language '%s' from '%s' and " // "exceptions from '%s' ...\n", lang, patFile, excFile); - hyphenator = new Hyphenator (patFile, excFile); + hyphenator = new Hyphenator (patFile.c_str(), excFile.c_str()); hyphenators->put (langString, hyphenator); - delete[] patFile; - delete[] excFile; } //lout::misc::StringBuffer sb;