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
f764925e
Commit
f764925e
authored
Apr 25, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instance: use std::unique_ptr<> to manage the NeighborGlue pointer
parent
692c8025
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
11 deletions
+9
-11
Instance.cxx
src/Instance.cxx
+4
-0
Instance.hxx
src/Instance.hxx
+1
-1
Main.cxx
src/Main.cxx
+3
-9
NeighborCommands.cxx
src/command/NeighborCommands.cxx
+1
-1
No files found.
src/Instance.cxx
View file @
f764925e
...
...
@@ -34,6 +34,10 @@
#include "db/update/Service.hxx"
#include "storage/StorageInterface.hxx"
#ifdef ENABLE_NEIGHBOR_PLUGINS
#include "neighbor/Glue.hxx"
#endif
#ifdef ENABLE_SQLITE
#include "sticker/Database.hxx"
#include "sticker/SongSticker.hxx"
...
...
src/Instance.hxx
View file @
f764925e
...
...
@@ -101,7 +101,7 @@ struct Instance final
MaskMonitor
idle_monitor
;
#ifdef ENABLE_NEIGHBOR_PLUGINS
NeighborGlue
*
neighbors
;
std
::
unique_ptr
<
NeighborGlue
>
neighbors
;
#endif
#ifdef ENABLE_DATABASE
...
...
src/Main.cxx
View file @
f764925e
...
...
@@ -448,15 +448,13 @@ MainOrThrow(int argc, char *argv[])
};
#ifdef ENABLE_NEIGHBOR_PLUGINS
instance
->
neighbors
=
new
NeighborGlue
();
instance
->
neighbors
=
std
::
make_unique
<
NeighborGlue
>
();
instance
->
neighbors
->
Init
(
raw_config
,
instance
->
io_thread
.
GetEventLoop
(),
*
instance
);
if
(
instance
->
neighbors
->
IsEmpty
())
{
delete
instance
->
neighbors
;
instance
->
neighbors
=
nullptr
;
}
if
(
instance
->
neighbors
->
IsEmpty
())
instance
->
neighbors
.
reset
();
#endif
const
unsigned
max_clients
=
...
...
@@ -625,10 +623,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
delete
instance
->
client_list
;
#ifdef ENABLE_NEIGHBOR_PLUGINS
delete
instance
->
neighbors
;
#endif
return
EXIT_SUCCESS
;
}
...
...
src/command/NeighborCommands.cxx
View file @
f764925e
...
...
@@ -37,7 +37,7 @@ CommandResult
handle_listneighbors
(
Client
&
client
,
gcc_unused
Request
args
,
Response
&
r
)
{
const
NeighborGlue
*
const
neighbors
=
client
.
GetInstance
().
neighbors
;
client
.
GetInstance
().
neighbors
.
get
()
;
if
(
neighbors
==
nullptr
)
{
r
.
Error
(
ACK_ERROR_UNKNOWN
,
"No neighbor plugin configured"
);
return
CommandResult
::
ERROR
;
...
...
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