Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
87bcf739
Commit
87bcf739
authored
Aug 07, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringUtil: rename strchug_fast() to StripLeft()
parent
db6db517
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
26 additions
and
29 deletions
+26
-29
PlaylistDatabase.cxx
src/PlaylistDatabase.cxx
+1
-1
SongSave.cxx
src/SongSave.cxx
+1
-1
ConfigFile.cxx
src/config/ConfigFile.cxx
+4
-4
RouteFilterPlugin.cxx
src/filter/plugins/RouteFilterPlugin.cxx
+4
-4
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+3
-3
CueParser.cxx
src/playlist/cue/CueParser.cxx
+2
-2
ExtM3uPlaylistPlugin.cxx
src/playlist/plugins/ExtM3uPlaylistPlugin.cxx
+2
-2
M3uPlaylistPlugin.cxx
src/playlist/plugins/M3uPlaylistPlugin.cxx
+1
-1
StringUtil.cxx
src/util/StringUtil.cxx
+2
-2
StringUtil.hxx
src/util/StringUtil.hxx
+3
-6
Tokenizer.cxx
src/util/Tokenizer.cxx
+3
-3
No files found.
src/PlaylistDatabase.cxx
View file @
87bcf739
...
@@ -60,7 +60,7 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name,
...
@@ -60,7 +60,7 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name,
}
}
*
colon
++
=
0
;
*
colon
++
=
0
;
value
=
strchug_fas
t
(
colon
);
value
=
StripLef
t
(
colon
);
if
(
strcmp
(
line
,
"mtime"
)
==
0
)
if
(
strcmp
(
line
,
"mtime"
)
==
0
)
pm
.
mtime
=
strtol
(
value
,
nullptr
,
10
);
pm
.
mtime
=
strtol
(
value
,
nullptr
,
10
);
...
...
src/SongSave.cxx
View file @
87bcf739
...
@@ -94,7 +94,7 @@ song_load(TextFile &file, const char *uri,
...
@@ -94,7 +94,7 @@ song_load(TextFile &file, const char *uri,
}
}
*
colon
++
=
0
;
*
colon
++
=
0
;
const
char
*
value
=
strchug_fas
t
(
colon
);
const
char
*
value
=
StripLef
t
(
colon
);
TagType
type
;
TagType
type
;
if
((
type
=
tag_name_parse
(
line
))
!=
TAG_NUM_OF_ITEM_TYPES
)
{
if
((
type
=
tag_name_parse
(
line
))
!=
TAG_NUM_OF_ITEM_TYPES
)
{
...
...
src/config/ConfigFile.cxx
View file @
87bcf739
...
@@ -96,7 +96,7 @@ config_read_block(FILE *fp, int *count, char *string, Error &error)
...
@@ -96,7 +96,7 @@ config_read_block(FILE *fp, int *count, char *string, Error &error)
}
}
(
*
count
)
++
;
(
*
count
)
++
;
line
=
strchug_fas
t
(
line
);
line
=
StripLef
t
(
line
);
if
(
*
line
==
0
||
*
line
==
CONF_COMMENT
)
if
(
*
line
==
0
||
*
line
==
CONF_COMMENT
)
continue
;
continue
;
...
@@ -104,7 +104,7 @@ config_read_block(FILE *fp, int *count, char *string, Error &error)
...
@@ -104,7 +104,7 @@ config_read_block(FILE *fp, int *count, char *string, Error &error)
/* end of this block; return from the function
/* end of this block; return from the function
(and from this "while" loop) */
(and from this "while" loop) */
line
=
strchug_fas
t
(
line
+
1
);
line
=
StripLef
t
(
line
+
1
);
if
(
*
line
!=
0
&&
*
line
!=
CONF_COMMENT
)
{
if
(
*
line
!=
0
&&
*
line
!=
CONF_COMMENT
)
{
delete
ret
;
delete
ret
;
error
.
Format
(
config_file_domain
,
error
.
Format
(
config_file_domain
,
...
@@ -155,7 +155,7 @@ ReadConfigFile(ConfigData &config_data, FILE *fp, Error &error)
...
@@ -155,7 +155,7 @@ ReadConfigFile(ConfigData &config_data, FILE *fp, Error &error)
count
++
;
count
++
;
line
=
strchug_fas
t
(
string
);
line
=
StripLef
t
(
string
);
if
(
*
line
==
0
||
*
line
==
CONF_COMMENT
)
if
(
*
line
==
0
||
*
line
==
CONF_COMMENT
)
continue
;
continue
;
...
@@ -205,7 +205,7 @@ ReadConfigFile(ConfigData &config_data, FILE *fp, Error &error)
...
@@ -205,7 +205,7 @@ ReadConfigFile(ConfigData &config_data, FILE *fp, Error &error)
return
false
;
return
false
;
}
}
line
=
strchug_fas
t
(
tokenizer
.
Rest
()
+
1
);
line
=
StripLef
t
(
tokenizer
.
Rest
()
+
1
);
if
(
*
line
!=
0
&&
*
line
!=
CONF_COMMENT
)
{
if
(
*
line
!=
0
&&
*
line
!=
CONF_COMMENT
)
{
error
.
Format
(
config_file_domain
,
error
.
Format
(
config_file_domain
,
"line %i: Unknown tokens after '{'"
,
"line %i: Unknown tokens after '{'"
,
...
...
src/filter/plugins/RouteFilterPlugin.cxx
View file @
87bcf739
...
@@ -142,11 +142,11 @@ RouteFilter::Configure(const config_param ¶m, Error &error) {
...
@@ -142,11 +142,11 @@ RouteFilter::Configure(const config_param ¶m, Error &error) {
// A cowardly default, just passthrough stereo
// A cowardly default, just passthrough stereo
const
char
*
routes
=
param
.
GetBlockValue
(
"routes"
,
"0>0, 1>1"
);
const
char
*
routes
=
param
.
GetBlockValue
(
"routes"
,
"0>0, 1>1"
);
while
(
true
)
{
while
(
true
)
{
routes
=
strchug_fas
t
(
routes
);
routes
=
StripLef
t
(
routes
);
char
*
endptr
;
char
*
endptr
;
const
unsigned
source
=
strtoul
(
routes
,
&
endptr
,
10
);
const
unsigned
source
=
strtoul
(
routes
,
&
endptr
,
10
);
endptr
=
strchug_fas
t
(
endptr
);
endptr
=
StripLef
t
(
endptr
);
if
(
endptr
==
routes
||
*
endptr
!=
'>'
)
{
if
(
endptr
==
routes
||
*
endptr
!=
'>'
)
{
error
.
Set
(
config_domain
,
error
.
Set
(
config_domain
,
"Malformed 'routes' specification"
);
"Malformed 'routes' specification"
);
...
@@ -163,10 +163,10 @@ RouteFilter::Configure(const config_param ¶m, Error &error) {
...
@@ -163,10 +163,10 @@ RouteFilter::Configure(const config_param ¶m, Error &error) {
if
(
source
>=
min_input_channels
)
if
(
source
>=
min_input_channels
)
min_input_channels
=
source
+
1
;
min_input_channels
=
source
+
1
;
routes
=
strchug_fas
t
(
endptr
+
1
);
routes
=
StripLef
t
(
endptr
+
1
);
unsigned
dest
=
strtoul
(
routes
,
&
endptr
,
10
);
unsigned
dest
=
strtoul
(
routes
,
&
endptr
,
10
);
endptr
=
strchug_fas
t
(
endptr
);
endptr
=
StripLef
t
(
endptr
);
if
(
endptr
==
routes
)
{
if
(
endptr
==
routes
)
{
error
.
Set
(
config_domain
,
error
.
Set
(
config_domain
,
"Malformed 'routes' specification"
);
"Malformed 'routes' specification"
);
...
...
src/fs/StandardDirectory.cxx
View file @
87bcf739
...
@@ -129,7 +129,7 @@ static bool
...
@@ -129,7 +129,7 @@ static bool
ParseConfigLine
(
char
*
line
,
const
char
*
dir_name
,
AllocatedPath
&
result_dir
)
ParseConfigLine
(
char
*
line
,
const
char
*
dir_name
,
AllocatedPath
&
result_dir
)
{
{
// strip leading white space
// strip leading white space
line
=
strchug_fas
t
(
line
);
line
=
StripLef
t
(
line
);
// check for end-of-line or comment
// check for end-of-line or comment
if
(
*
line
==
'\0'
||
*
line
==
'#'
)
if
(
*
line
==
'\0'
||
*
line
==
'#'
)
...
@@ -141,11 +141,11 @@ ParseConfigLine(char *line, const char *dir_name, AllocatedPath &result_dir)
...
@@ -141,11 +141,11 @@ ParseConfigLine(char *line, const char *dir_name, AllocatedPath &result_dir)
line
+=
strlen
(
dir_name
);
line
+=
strlen
(
dir_name
);
// strip equals sign and spaces around it
// strip equals sign and spaces around it
line
=
strchug_fas
t
(
line
);
line
=
StripLef
t
(
line
);
if
(
*
line
!=
'='
)
if
(
*
line
!=
'='
)
return
false
;
return
false
;
++
line
;
++
line
;
line
=
strchug_fas
t
(
line
);
line
=
StripLef
t
(
line
);
// check if path is quoted
// check if path is quoted
bool
quoted
=
false
;
bool
quoted
=
false
;
...
...
src/playlist/cue/CueParser.cxx
View file @
87bcf739
...
@@ -80,7 +80,7 @@ cue_next_quoted(char *p, char **pp)
...
@@ -80,7 +80,7 @@ cue_next_quoted(char *p, char **pp)
static
const
char
*
static
const
char
*
cue_next_token
(
char
**
pp
)
cue_next_token
(
char
**
pp
)
{
{
char
*
p
=
strchug_fas
t
(
*
pp
);
char
*
p
=
StripLef
t
(
*
pp
);
if
(
*
p
==
0
)
if
(
*
p
==
0
)
return
nullptr
;
return
nullptr
;
...
@@ -90,7 +90,7 @@ cue_next_token(char **pp)
...
@@ -90,7 +90,7 @@ cue_next_token(char **pp)
static
const
char
*
static
const
char
*
cue_next_value
(
char
**
pp
)
cue_next_value
(
char
**
pp
)
{
{
char
*
p
=
strchug_fas
t
(
*
pp
);
char
*
p
=
StripLef
t
(
*
pp
);
if
(
*
p
==
0
)
if
(
*
p
==
0
)
return
nullptr
;
return
nullptr
;
...
...
src/playlist/plugins/ExtM3uPlaylistPlugin.cxx
View file @
87bcf739
...
@@ -82,7 +82,7 @@ extm3u_parse_tag(const char *line)
...
@@ -82,7 +82,7 @@ extm3u_parse_tag(const char *line)
/* 0 means unknown duration */
/* 0 means unknown duration */
duration
=
0
;
duration
=
0
;
name
=
strchug_fas
t
(
endptr
+
1
);
name
=
StripLef
t
(
endptr
+
1
);
if
(
*
name
==
0
&&
duration
==
0
)
if
(
*
name
==
0
&&
duration
==
0
)
/* no information available; don't allocate a tag
/* no information available; don't allocate a tag
object */
object */
...
@@ -116,7 +116,7 @@ ExtM3uPlaylist::NextSong()
...
@@ -116,7 +116,7 @@ ExtM3uPlaylist::NextSong()
continue
;
continue
;
}
}
line_s
=
strchug_fas
t
(
line_s
);
line_s
=
StripLef
t
(
line_s
);
}
while
(
line_s
[
0
]
==
'#'
||
*
line_s
==
0
);
}
while
(
line_s
[
0
]
==
'#'
||
*
line_s
==
0
);
return
new
DetachedSong
(
line_s
,
std
::
move
(
tag
));
return
new
DetachedSong
(
line_s
,
std
::
move
(
tag
));
...
...
src/playlist/plugins/M3uPlaylistPlugin.cxx
View file @
87bcf739
...
@@ -52,7 +52,7 @@ M3uPlaylist::NextSong()
...
@@ -52,7 +52,7 @@ M3uPlaylist::NextSong()
if
(
line_s
==
nullptr
)
if
(
line_s
==
nullptr
)
return
nullptr
;
return
nullptr
;
line_s
=
strchug_fas
t
(
line_s
);
line_s
=
StripLef
t
(
line_s
);
}
while
(
line_s
[
0
]
==
'#'
||
*
line_s
==
0
);
}
while
(
line_s
[
0
]
==
'#'
||
*
line_s
==
0
);
return
new
DetachedSong
(
line_s
);
return
new
DetachedSong
(
line_s
);
...
...
src/util/StringUtil.cxx
View file @
87bcf739
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include <string.h>
#include <string.h>
const
char
*
const
char
*
strchug_fas
t
(
const
char
*
p
)
StripLef
t
(
const
char
*
p
)
{
{
while
(
IsWhitespaceNotNull
(
*
p
))
while
(
IsWhitespaceNotNull
(
*
p
))
++
p
;
++
p
;
...
@@ -38,7 +38,7 @@ strchug_fast(const char *p)
...
@@ -38,7 +38,7 @@ strchug_fast(const char *p)
char
*
char
*
Strip
(
char
*
p
)
Strip
(
char
*
p
)
{
{
p
=
strchug_fas
t
(
p
);
p
=
StripLef
t
(
p
);
size_t
length
=
strlen
(
p
);
size_t
length
=
strlen
(
p
);
while
(
length
>
0
&&
IsWhitespaceNotNull
(
p
[
length
-
1
]))
while
(
length
>
0
&&
IsWhitespaceNotNull
(
p
[
length
-
1
]))
...
...
src/util/StringUtil.hxx
View file @
87bcf739
...
@@ -27,19 +27,16 @@
...
@@ -27,19 +27,16 @@
/**
/**
* Returns a pointer to the first non-whitespace character in the
* Returns a pointer to the first non-whitespace character in the
* string, or to the end of the string.
* string, or to the end of the string.
*
* This is a faster version of g_strchug(), because it does not move
* data.
*/
*/
gcc_pure
gcc_pure
const
char
*
const
char
*
strchug_fas
t
(
const
char
*
p
);
StripLef
t
(
const
char
*
p
);
gcc_pure
gcc_pure
static
inline
char
*
static
inline
char
*
strchug_fas
t
(
char
*
p
)
StripLef
t
(
char
*
p
)
{
{
return
const_cast
<
char
*>
(
strchug_fas
t
((
const
char
*
)
p
));
return
const_cast
<
char
*>
(
StripLef
t
((
const
char
*
)
p
));
}
}
/**
/**
...
...
src/util/Tokenizer.cxx
View file @
87bcf739
...
@@ -71,7 +71,7 @@ Tokenizer::NextWord(Error &error)
...
@@ -71,7 +71,7 @@ Tokenizer::NextWord(Error &error)
/* a whitespace: the word ends here */
/* a whitespace: the word ends here */
*
input
=
0
;
*
input
=
0
;
/* skip all following spaces, too */
/* skip all following spaces, too */
input
=
strchug_fas
t
(
input
+
1
);
input
=
StripLef
t
(
input
+
1
);
break
;
break
;
}
}
...
@@ -116,7 +116,7 @@ Tokenizer::NextUnquoted(Error &error)
...
@@ -116,7 +116,7 @@ Tokenizer::NextUnquoted(Error &error)
/* a whitespace: the word ends here */
/* a whitespace: the word ends here */
*
input
=
0
;
*
input
=
0
;
/* skip all following spaces, too */
/* skip all following spaces, too */
input
=
strchug_fas
t
(
input
+
1
);
input
=
StripLef
t
(
input
+
1
);
break
;
break
;
}
}
...
@@ -185,7 +185,7 @@ Tokenizer::NextString(Error &error)
...
@@ -185,7 +185,7 @@ Tokenizer::NextString(Error &error)
/* finish the string and return it */
/* finish the string and return it */
*
dest
=
0
;
*
dest
=
0
;
input
=
strchug_fas
t
(
input
);
input
=
StripLef
t
(
input
);
return
word
;
return
word
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment