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
34b309b9
Commit
34b309b9
authored
Jan 30, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OtherCommands: merge duplicate code from handle_update(), handle_rescan()
parent
c6725884
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
31 deletions
+10
-31
OtherCommands.cxx
src/command/OtherCommands.cxx
+10
-31
No files found.
src/command/OtherCommands.cxx
View file @
34b309b9
...
@@ -183,8 +183,8 @@ handle_lsinfo(Client &client, int argc, char *argv[])
...
@@ -183,8 +183,8 @@ handle_lsinfo(Client &client, int argc, char *argv[])
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
CommandResult
static
CommandResult
handle_update
(
Client
&
client
,
gcc_unused
int
argc
,
char
*
argv
[]
)
handle_update
(
Client
&
client
,
int
argc
,
char
*
argv
[],
bool
discard
)
{
{
const
char
*
path
=
""
;
const
char
*
path
=
""
;
...
@@ -208,7 +208,7 @@ handle_update(Client &client, gcc_unused int argc, char *argv[])
...
@@ -208,7 +208,7 @@ handle_update(Client &client, gcc_unused int argc, char *argv[])
return
CommandResult
::
ERROR
;
return
CommandResult
::
ERROR
;
}
}
unsigned
ret
=
update
->
Enqueue
(
path
,
false
);
unsigned
ret
=
update
->
Enqueue
(
path
,
discard
);
if
(
ret
>
0
)
{
if
(
ret
>
0
)
{
client_printf
(
client
,
"updating_db: %i
\n
"
,
ret
);
client_printf
(
client
,
"updating_db: %i
\n
"
,
ret
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
...
@@ -220,36 +220,15 @@ handle_update(Client &client, gcc_unused int argc, char *argv[])
...
@@ -220,36 +220,15 @@ handle_update(Client &client, gcc_unused int argc, char *argv[])
}
}
CommandResult
CommandResult
handle_
rescan
(
Client
&
client
,
gcc_unused
int
argc
,
char
*
argv
[])
handle_
update
(
Client
&
client
,
gcc_unused
int
argc
,
char
*
argv
[])
{
{
const
char
*
path
=
""
;
return
handle_update
(
client
,
argc
,
argv
,
false
);
}
assert
(
argc
<=
2
);
if
(
argc
==
2
)
{
path
=
argv
[
1
];
if
(
!
uri_safe_local
(
path
))
{
command_error
(
client
,
ACK_ERROR_ARG
,
"Malformed path"
);
return
CommandResult
::
ERROR
;
}
}
UpdateService
*
update
=
client
.
partition
.
instance
.
update
;
if
(
update
==
nullptr
)
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No database"
);
return
CommandResult
::
ERROR
;
}
unsigned
ret
=
update
->
Enqueue
(
path
,
true
);
CommandResult
if
(
ret
>
0
)
{
handle_rescan
(
Client
&
client
,
gcc_unused
int
argc
,
char
*
argv
[])
client_printf
(
client
,
"updating_db: %i
\n
"
,
ret
);
{
return
CommandResult
::
OK
;
return
handle_update
(
client
,
argc
,
argv
,
true
);
}
else
{
command_error
(
client
,
ACK_ERROR_UPDATE_ALREADY
,
"already updating"
);
return
CommandResult
::
ERROR
;
}
}
}
CommandResult
CommandResult
...
...
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