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
d099a7e4
Commit
d099a7e4
authored
Oct 31, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
songvec: simplified compare_tag_item()
Moved some code to tag_get_value_checked(), to eliminate several NULL checks.
parent
25a806a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
songvec.c
src/songvec.c
+10
-8
No files found.
src/songvec.c
View file @
d099a7e4
...
@@ -29,6 +29,14 @@
...
@@ -29,6 +29,14 @@
static
GMutex
*
nr_lock
=
NULL
;
static
GMutex
*
nr_lock
=
NULL
;
static
const
char
*
tag_get_value_checked
(
const
struct
tag
*
tag
,
enum
tag_type
type
)
{
return
tag
!=
NULL
?
tag_get_value
(
tag
,
type
)
:
NULL
;
}
/**
/**
* Compare two tag values which should contain an integer value
* Compare two tag values which should contain an integer value
* (e.g. disc or track number). Either one may be NULL.
* (e.g. disc or track number). Either one may be NULL.
...
@@ -51,14 +59,8 @@ compare_number_string(const char *a, const char *b)
...
@@ -51,14 +59,8 @@ compare_number_string(const char *a, const char *b)
static
int
static
int
compare_tag_item
(
const
struct
tag
*
a
,
const
struct
tag
*
b
,
enum
tag_type
type
)
compare_tag_item
(
const
struct
tag
*
a
,
const
struct
tag
*
b
,
enum
tag_type
type
)
{
{
if
(
a
==
NULL
)
return
compare_number_string
(
tag_get_value_checked
(
a
,
type
),
return
b
==
NULL
?
0
:
-
1
;
tag_get_value_checked
(
b
,
type
));
if
(
b
==
NULL
)
return
1
;
return
compare_number_string
(
tag_get_value
(
a
,
type
),
tag_get_value
(
b
,
type
));
}
}
/* Only used for sorting/searchin a songvec, not general purpose compares */
/* Only used for sorting/searchin a songvec, not general purpose compares */
...
...
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