mirror of
https://github.com/luanti-org/minetestmapper.git
synced 2025-10-06 05:45:21 +02:00
General code cleanups/maintenance
This commit is contained in:
8
util.cpp
8
util.cpp
@@ -3,15 +3,15 @@
|
||||
|
||||
#include "util.h"
|
||||
|
||||
static inline std::string trim(const std::string &s)
|
||||
static std::string trim(const std::string &s)
|
||||
{
|
||||
auto isspace = [] (char c) -> bool { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; };
|
||||
|
||||
size_t front = 0;
|
||||
while(isspace(s[front]))
|
||||
while (isspace(s[front]))
|
||||
++front;
|
||||
size_t back = s.size() - 1;
|
||||
while(back > front && isspace(s[back]))
|
||||
while (back > front && isspace(s[back]))
|
||||
--back;
|
||||
|
||||
return s.substr(front, back - front + 1);
|
||||
@@ -23,7 +23,7 @@ std::string read_setting(const std::string &name, std::istream &is)
|
||||
while (is.good()) {
|
||||
is.getline(linebuf, sizeof(linebuf));
|
||||
|
||||
for(char *p = linebuf; *p; p++) {
|
||||
for (char *p = linebuf; *p; p++) {
|
||||
if(*p != '#')
|
||||
continue;
|
||||
*p = '\0'; // Cut off at the first #
|
||||
|
Reference in New Issue
Block a user