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
2fad5783
Commit
2fad5783
authored
Jan 15, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag: added tag_get_value()
parent
4847bbaa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
tag.c
src/tag.c
+9
-3
tag.h
src/tag.h
+7
-0
No files found.
src/tag.c
View file @
2fad5783
...
...
@@ -365,16 +365,22 @@ tag_merge(const struct tag *base, const struct tag *add)
return
ret
;
}
bool
tag_has_type
(
const
struct
tag
*
tag
,
enum
tag_type
type
)
const
char
*
tag_get_value
(
const
struct
tag
*
tag
,
enum
tag_type
type
)
{
assert
(
tag
!=
NULL
);
assert
(
type
<
TAG_NUM_OF_ITEM_TYPES
);
for
(
unsigned
i
=
0
;
i
<
tag
->
numOfItems
;
i
++
)
if
(
tag
->
items
[
i
]
->
type
==
type
)
return
true
;
return
tag
->
items
[
i
]
->
value
;
return
NULL
;
}
return
false
;
bool
tag_has_type
(
const
struct
tag
*
tag
,
enum
tag_type
type
)
{
return
tag_get_value
(
tag
,
type
)
!=
NULL
;
}
int
tag_equal
(
const
struct
tag
*
tag1
,
const
struct
tag
*
tag2
)
...
...
src/tag.h
View file @
2fad5783
...
...
@@ -110,6 +110,13 @@ tag_is_empty(const struct tag *tag)
}
/**
* Returns the first value of the specified tag type, or NULL if none
* is present in this tag object.
*/
const
char
*
tag_get_value
(
const
struct
tag
*
tag
,
enum
tag_type
type
);
/**
* Checks whether the tag contains one or more items with
* the specified type.
*/
...
...
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