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
2e72a9b2
Commit
2e72a9b2
authored
Mar 17, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag: added function tag_merge_replace()
Like tag_merge(), but can deal with NULL parameters, and frees both tag objects.
parent
96033e4b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
21 deletions
+26
-21
cue_tag.c
src/cue/cue_tag.c
+1
-21
tag.c
src/tag.c
+16
-0
tag.h
src/tag.h
+9
-0
No files found.
src/cue/cue_tag.c
View file @
2e72a9b2
...
...
@@ -173,7 +173,6 @@ cue_tag_file( FILE* fp,
{
struct
tag
*
cd_tag
=
NULL
;
struct
tag
*
track_tag
=
NULL
;
struct
tag
*
merge_tag
=
NULL
;
struct
Cd
*
cd
=
NULL
;
if
(
tnum
>
256
)
...
...
@@ -199,26 +198,7 @@ cue_tag_file( FILE* fp,
cd_delete
(
cd
);
}
if
((
cd_tag
!=
NULL
)
&&
(
track_tag
!=
NULL
))
{
merge_tag
=
tag_merge
(
cd_tag
,
track_tag
);
tag_free
(
cd_tag
);
tag_free
(
track_tag
);
return
merge_tag
;
}
else
if
(
cd_tag
!=
NULL
)
{
return
cd_tag
;
}
else
if
(
track_tag
!=
NULL
)
{
return
track_tag
;
}
else
return
NULL
;
return
tag_merge_replace
(
cd_tag
,
track_tag
);
}
struct
tag
*
...
...
src/tag.c
View file @
2e72a9b2
...
...
@@ -247,6 +247,22 @@ tag_merge(const struct tag *base, const struct tag *add)
return
ret
;
}
struct
tag
*
tag_merge_replace
(
struct
tag
*
base
,
struct
tag
*
add
)
{
if
(
add
==
NULL
)
return
base
;
if
(
base
==
NULL
)
return
add
;
struct
tag
*
tag
=
tag_merge
(
base
,
add
);
tag_free
(
base
);
tag_free
(
add
);
return
tag
;
}
const
char
*
tag_get_value
(
const
struct
tag
*
tag
,
enum
tag_type
type
)
{
...
...
src/tag.h
View file @
2e72a9b2
...
...
@@ -166,6 +166,15 @@ struct tag *
tag_merge
(
const
struct
tag
*
base
,
const
struct
tag
*
add
);
/**
* Merges the data from two tags. Any of the two may be NULL. Both
* are freed by this function.
*
* @return a newly allocated tag, which must be freed with tag_free()
*/
struct
tag
*
tag_merge_replace
(
struct
tag
*
base
,
struct
tag
*
add
);
/**
* Returns true if the tag contains no items. This ignores the "time"
* attribute.
*/
...
...
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