Use single characters instead of strings where possible

This makes the code clearer and faster
This commit is contained in:
Rose 2023-10-12 14:16:29 -04:00
parent 7d4e1cd629
commit 5932fff4e2
7 changed files with 10 additions and 10 deletions

View File

@ -291,7 +291,7 @@ static void manual_input (void) {
}
}
lua_settop(L, 0); /* clear stack */
fputs("\n", stdout);
fputc('\n', stdout);
progname = oldprogname;
}

View File

@ -42,7 +42,7 @@ void DoxygenEntity::printEntity(int level) const {
if (isLeaf) {
for (int i = 0; i < thisLevel; i++) {
cout << "\t";
cout << '\t';
}
cout << "Node Leaf Command: '" << typeOfEntity << "', ";
@ -55,7 +55,7 @@ void DoxygenEntity::printEntity(int level) const {
} else {
for (int i = 0; i < thisLevel; i++) {
cout << "\t";
cout << '\t';
}
cout << "Node Command: '" << typeOfEntity << "'" << std::endl;

View File

@ -1252,7 +1252,7 @@ void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) {
printListError(WARN_DOXYGEN_HTML_ERROR, "Doxygen HTML error for tag " + cmd + ": Illegal end HTML tag without greater-than ('>') found.");
}
endHtmlPos = line.find(">", pos);
endHtmlPos = line.find('>', pos);
if (endHtmlPos == string::npos) {
m_tokenListIt = m_tokenList.end();
printListError(WARN_DOXYGEN_HTML_ERROR, "Doxygen HTML error for tag " + cmd + ": HTML tag without greater-than ('>') found.");
@ -1474,7 +1474,7 @@ void DoxygenParser::printList() {
int tokNo = 0;
for (TokenListCIt it = m_tokenList.begin(); it != m_tokenList.end(); it++, tokNo++) {
cout << it->toString() << " ";
cout << it->toString() << ' ';
if ((tokNo % TOKENSPERLINE) == 0) {
cout << endl;

View File

@ -254,7 +254,7 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind
i += APPROX_LINE_LENGTH - indent * TAB_SIZE;
}
i = unformattedLine.find(" ", i);
i = unformattedLine.find(' ', i);
if (i > 0 && i + 1 < unformattedLine.length()) {
if (!isFirstLine)

View File

@ -942,7 +942,7 @@ String *PyDocConverter::makeDocumentation(Node *n) {
for (size_t realOverloadCount = 0; realOverloadCount < allDocumentation.size(); realOverloadCount++) {
if (realOverloadCount != 0) {
// separate it from the preceding one.
concatDocString << "\n" << indentStr << "|\n\n";
concatDocString << '\n' << indentStr << "|\n\n";
}
oneDoc = allDocumentation[realOverloadCount];

View File

@ -63,7 +63,7 @@ std::string JSShell::LoadModule(const std::string& name, HANDLE* library) {
}
if(handle == 0) {
std::cerr << "Could not find module " << lib_path << ":"
std::cerr << "Could not find module " << lib_path << ':'
<< std::endl << LIBRARY_ERROR() << std::endl;
return 0;
}
@ -120,7 +120,7 @@ std::string JSShell::ReadFile(const std::string& fileName)
}
file.close();
} else {
std::cout << "Unable to open file " << fileName << "." << std::endl;
std::cout << "Unable to open file " << fileName << '.' << std::endl;
}
return script;

View File

@ -225,7 +225,7 @@ void JSCShell::PrintError(JSContextRef ctx, JSValueRef err) {
int line = (int) JSValueToNumber(ctx, jsLine, 0);
JSStringRelease(lineKey);
std::cerr << sourceURL << ":" << line << ":" << errMsg << std::endl;
std::cerr << sourceURL << ':' << line << ':' << errMsg << std::endl;
}
JSShell* JSCShell_Create() {