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
663815ea
Commit
663815ea
authored
Sep 07, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist_vector: update_or_add() returns bool
False if the vector was not modified.
parent
bc87ec00
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
playlist_vector.c
src/playlist_vector.c
+6
-1
playlist_vector.h
src/playlist_vector.h
+4
-1
No files found.
src/playlist_vector.c
View file @
663815ea
...
@@ -93,16 +93,21 @@ playlist_vector_add(struct playlist_vector *pv,
...
@@ -93,16 +93,21 @@ playlist_vector_add(struct playlist_vector *pv,
pv
->
head
=
pm
;
pv
->
head
=
pm
;
}
}
void
bool
playlist_vector_update_or_add
(
struct
playlist_vector
*
pv
,
playlist_vector_update_or_add
(
struct
playlist_vector
*
pv
,
const
char
*
name
,
time_t
mtime
)
const
char
*
name
,
time_t
mtime
)
{
{
struct
playlist_metadata
**
pmp
=
playlist_vector_find_p
(
pv
,
name
);
struct
playlist_metadata
**
pmp
=
playlist_vector_find_p
(
pv
,
name
);
if
(
pmp
!=
NULL
)
{
if
(
pmp
!=
NULL
)
{
struct
playlist_metadata
*
pm
=
*
pmp
;
struct
playlist_metadata
*
pm
=
*
pmp
;
if
(
mtime
==
pm
->
mtime
)
return
false
;
pm
->
mtime
=
mtime
;
pm
->
mtime
=
mtime
;
}
else
}
else
playlist_vector_add
(
pv
,
name
,
mtime
);
playlist_vector_add
(
pv
,
name
,
mtime
);
return
true
;
}
}
bool
bool
...
...
src/playlist_vector.h
View file @
663815ea
...
@@ -58,7 +58,10 @@ void
...
@@ -58,7 +58,10 @@ void
playlist_vector_add
(
struct
playlist_vector
*
pv
,
playlist_vector_add
(
struct
playlist_vector
*
pv
,
const
char
*
name
,
time_t
mtime
);
const
char
*
name
,
time_t
mtime
);
void
/**
* @return true if the vector or one of its items was modified
*/
bool
playlist_vector_update_or_add
(
struct
playlist_vector
*
pv
,
playlist_vector_update_or_add
(
struct
playlist_vector
*
pv
,
const
char
*
name
,
time_t
mtime
);
const
char
*
name
,
time_t
mtime
);
...
...
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