diff options
author | Max Kellermann <max@duempel.org> | 2014-08-07 14:53:07 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-07 16:08:02 +0200 |
commit | 87bcf739ee6a3e8ac5b400b35b61b72b9d8bd802 (patch) | |
tree | 9f2170889dfbfff90816d7d4eea7b19373ba213f /src | |
parent | db6db517424e09bab9a12934e9df6807a7049926 (diff) | |
download | mpd-87bcf739ee6a3e8ac5b400b35b61b72b9d8bd802.tar.gz mpd-87bcf739ee6a3e8ac5b400b35b61b72b9d8bd802.tar.xz mpd-87bcf739ee6a3e8ac5b400b35b61b72b9d8bd802.zip |
util/StringUtil: rename strchug_fast() to StripLeft()
Diffstat (limited to '')
-rw-r--r-- | src/PlaylistDatabase.cxx | 2 | ||||
-rw-r--r-- | src/SongSave.cxx | 2 | ||||
-rw-r--r-- | src/config/ConfigFile.cxx | 8 | ||||
-rw-r--r-- | src/filter/plugins/RouteFilterPlugin.cxx | 8 | ||||
-rw-r--r-- | src/fs/StandardDirectory.cxx | 6 | ||||
-rw-r--r-- | src/playlist/cue/CueParser.cxx | 4 | ||||
-rw-r--r-- | src/playlist/plugins/ExtM3uPlaylistPlugin.cxx | 4 | ||||
-rw-r--r-- | src/playlist/plugins/M3uPlaylistPlugin.cxx | 2 | ||||
-rw-r--r-- | src/util/StringUtil.cxx | 4 | ||||
-rw-r--r-- | src/util/StringUtil.hxx | 9 | ||||
-rw-r--r-- | src/util/Tokenizer.cxx | 6 |
11 files changed, 26 insertions, 29 deletions
diff --git a/src/PlaylistDatabase.cxx b/src/PlaylistDatabase.cxx index 336a6d0e0..e4fd3ff28 100644 --- a/src/PlaylistDatabase.cxx +++ b/src/PlaylistDatabase.cxx @@ -60,7 +60,7 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name, } *colon++ = 0; - value = strchug_fast(colon); + value = StripLeft(colon); if (strcmp(line, "mtime") == 0) pm.mtime = strtol(value, nullptr, 10); diff --git a/src/SongSave.cxx b/src/SongSave.cxx index 02a7861e5..bf6194a4f 100644 --- a/src/SongSave.cxx +++ b/src/SongSave.cxx @@ -94,7 +94,7 @@ song_load(TextFile &file, const char *uri, } *colon++ = 0; - const char *value = strchug_fast(colon); + const char *value = StripLeft(colon); TagType type; if ((type = tag_name_parse(line)) != TAG_NUM_OF_ITEM_TYPES) { diff --git a/src/config/ConfigFile.cxx b/src/config/ConfigFile.cxx index f045213a4..1329c4cd4 100644 --- a/src/config/ConfigFile.cxx +++ b/src/config/ConfigFile.cxx @@ -96,7 +96,7 @@ config_read_block(FILE *fp, int *count, char *string, Error &error) } (*count)++; - line = strchug_fast(line); + line = StripLeft(line); if (*line == 0 || *line == CONF_COMMENT) continue; @@ -104,7 +104,7 @@ config_read_block(FILE *fp, int *count, char *string, Error &error) /* end of this block; return from the function (and from this "while" loop) */ - line = strchug_fast(line + 1); + line = StripLeft(line + 1); if (*line != 0 && *line != CONF_COMMENT) { delete ret; error.Format(config_file_domain, @@ -155,7 +155,7 @@ ReadConfigFile(ConfigData &config_data, FILE *fp, Error &error) count++; - line = strchug_fast(string); + line = StripLeft(string); if (*line == 0 || *line == CONF_COMMENT) continue; @@ -205,7 +205,7 @@ ReadConfigFile(ConfigData &config_data, FILE *fp, Error &error) return false; } - line = strchug_fast(tokenizer.Rest() + 1); + line = StripLeft(tokenizer.Rest() + 1); if (*line != 0 && *line != CONF_COMMENT) { error.Format(config_file_domain, "line %i: Unknown tokens after '{'", diff --git a/src/filter/plugins/RouteFilterPlugin.cxx b/src/filter/plugins/RouteFilterPlugin.cxx index 38c4ec43b..d4bb0be9c 100644 --- a/src/filter/plugins/RouteFilterPlugin.cxx +++ b/src/filter/plugins/RouteFilterPlugin.cxx @@ -142,11 +142,11 @@ RouteFilter::Configure(const config_param ¶m, Error &error) { // A cowardly default, just passthrough stereo const char *routes = param.GetBlockValue("routes", "0>0, 1>1"); while (true) { - routes = strchug_fast(routes); + routes = StripLeft(routes); char *endptr; const unsigned source = strtoul(routes, &endptr, 10); - endptr = strchug_fast(endptr); + endptr = StripLeft(endptr); if (endptr == routes || *endptr != '>') { error.Set(config_domain, "Malformed 'routes' specification"); @@ -163,10 +163,10 @@ RouteFilter::Configure(const config_param ¶m, Error &error) { if (source >= min_input_channels) min_input_channels = source + 1; - routes = strchug_fast(endptr + 1); + routes = StripLeft(endptr + 1); unsigned dest = strtoul(routes, &endptr, 10); - endptr = strchug_fast(endptr); + endptr = StripLeft(endptr); if (endptr == routes) { error.Set(config_domain, "Malformed 'routes' specification"); diff --git a/src/fs/StandardDirectory.cxx b/src/fs/StandardDirectory.cxx index c266480f7..c922b22d3 100644 --- a/src/fs/StandardDirectory.cxx +++ b/src/fs/StandardDirectory.cxx @@ -129,7 +129,7 @@ static bool ParseConfigLine(char *line, const char *dir_name, AllocatedPath &result_dir) { // strip leading white space - line = strchug_fast(line); + line = StripLeft(line); // check for end-of-line or comment if (*line == '\0' || *line == '#') @@ -141,11 +141,11 @@ ParseConfigLine(char *line, const char *dir_name, AllocatedPath &result_dir) line += strlen(dir_name); // strip equals sign and spaces around it - line = strchug_fast(line); + line = StripLeft(line); if (*line != '=') return false; ++line; - line = strchug_fast(line); + line = StripLeft(line); // check if path is quoted bool quoted = false; diff --git a/src/playlist/cue/CueParser.cxx b/src/playlist/cue/CueParser.cxx index fd467dbc0..10f28b5a1 100644 --- a/src/playlist/cue/CueParser.cxx +++ b/src/playlist/cue/CueParser.cxx @@ -80,7 +80,7 @@ cue_next_quoted(char *p, char **pp) static const char * cue_next_token(char **pp) { - char *p = strchug_fast(*pp); + char *p = StripLeft(*pp); if (*p == 0) return nullptr; @@ -90,7 +90,7 @@ cue_next_token(char **pp) static const char * cue_next_value(char **pp) { - char *p = strchug_fast(*pp); + char *p = StripLeft(*pp); if (*p == 0) return nullptr; diff --git a/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx b/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx index 95cc84289..9d277ec3f 100644 --- a/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx +++ b/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx @@ -82,7 +82,7 @@ extm3u_parse_tag(const char *line) /* 0 means unknown duration */ duration = 0; - name = strchug_fast(endptr + 1); + name = StripLeft(endptr + 1); if (*name == 0 && duration == 0) /* no information available; don't allocate a tag object */ @@ -116,7 +116,7 @@ ExtM3uPlaylist::NextSong() continue; } - line_s = strchug_fast(line_s); + line_s = StripLeft(line_s); } while (line_s[0] == '#' || *line_s == 0); return new DetachedSong(line_s, std::move(tag)); diff --git a/src/playlist/plugins/M3uPlaylistPlugin.cxx b/src/playlist/plugins/M3uPlaylistPlugin.cxx index c7f3b5085..977587377 100644 --- a/src/playlist/plugins/M3uPlaylistPlugin.cxx +++ b/src/playlist/plugins/M3uPlaylistPlugin.cxx @@ -52,7 +52,7 @@ M3uPlaylist::NextSong() if (line_s == nullptr) return nullptr; - line_s = strchug_fast(line_s); + line_s = StripLeft(line_s); } while (line_s[0] == '#' || *line_s == 0); return new DetachedSong(line_s); diff --git a/src/util/StringUtil.cxx b/src/util/StringUtil.cxx index 50885a34a..153846e9b 100644 --- a/src/util/StringUtil.cxx +++ b/src/util/StringUtil.cxx @@ -27,7 +27,7 @@ #include <string.h> const char * -strchug_fast(const char *p) +StripLeft(const char *p) { while (IsWhitespaceNotNull(*p)) ++p; @@ -38,7 +38,7 @@ strchug_fast(const char *p) char * Strip(char *p) { - p = strchug_fast(p); + p = StripLeft(p); size_t length = strlen(p); while (length > 0 && IsWhitespaceNotNull(p[length - 1])) diff --git a/src/util/StringUtil.hxx b/src/util/StringUtil.hxx index e8e3b2b5d..6bccbeffe 100644 --- a/src/util/StringUtil.hxx +++ b/src/util/StringUtil.hxx @@ -27,19 +27,16 @@ /** * Returns a pointer to the first non-whitespace character in the * string, or to the end of the string. - * - * This is a faster version of g_strchug(), because it does not move - * data. */ gcc_pure const char * -strchug_fast(const char *p); +StripLeft(const char *p); gcc_pure static inline char * -strchug_fast(char *p) +StripLeft(char *p) { - return const_cast<char *>(strchug_fast((const char *)p)); + return const_cast<char *>(StripLeft((const char *)p)); } /** diff --git a/src/util/Tokenizer.cxx b/src/util/Tokenizer.cxx index 306a90074..19322b70d 100644 --- a/src/util/Tokenizer.cxx +++ b/src/util/Tokenizer.cxx @@ -71,7 +71,7 @@ Tokenizer::NextWord(Error &error) /* a whitespace: the word ends here */ *input = 0; /* skip all following spaces, too */ - input = strchug_fast(input + 1); + input = StripLeft(input + 1); break; } @@ -116,7 +116,7 @@ Tokenizer::NextUnquoted(Error &error) /* a whitespace: the word ends here */ *input = 0; /* skip all following spaces, too */ - input = strchug_fast(input + 1); + input = StripLeft(input + 1); break; } @@ -185,7 +185,7 @@ Tokenizer::NextString(Error &error) /* finish the string and return it */ *dest = 0; - input = strchug_fast(input); + input = StripLeft(input); return word; } |