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
eb8fd079
Commit
eb8fd079
authored
Jun 17, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/nfs/Manager: gcc 4.7 compatibility hack
std::map::emplace() is only available from gcc 4.8 on.
parent
c99559db
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
Connection.hxx
src/lib/nfs/Connection.hxx
+16
-0
Manager.cxx
src/lib/nfs/Manager.cxx
+9
-0
Manager.hxx
src/lib/nfs/Manager.hxx
+7
-0
No files found.
src/lib/nfs/Connection.hxx
View file @
eb8fd079
...
...
@@ -103,6 +103,22 @@ public:
server
(
_server
),
export_name
(
_export_name
),
context
(
nullptr
)
{}
#if defined(__GNUC__) && !defined(__clang__) && !GCC_CHECK_VERSION(4,8)
/* needed for NfsManager::GetConnection() due to lack of
std::map::emplace() */
NfsConnection
(
NfsConnection
&&
other
)
:
SocketMonitor
(((
SocketMonitor
&
)
other
).
GetEventLoop
()),
DeferredMonitor
(((
DeferredMonitor
&
)
other
).
GetEventLoop
()),
server
(
std
::
move
(
other
.
server
)),
export_name
(
std
::
move
(
other
.
export_name
)),
context
(
nullptr
)
{
assert
(
other
.
context
==
nullptr
);
assert
(
other
.
new_leases
.
empty
());
assert
(
other
.
active_leases
.
empty
());
assert
(
other
.
callbacks
.
IsEmpty
());
}
#endif
~
NfsConnection
();
gcc_pure
...
...
src/lib/nfs/Manager.cxx
View file @
eb8fd079
...
...
@@ -39,10 +39,19 @@ NfsManager::GetConnection(const char *server, const char *export_name)
const
std
::
string
key
=
Key
(
server
,
export_name
);
#if defined(__GNUC__) && !defined(__clang__) && !GCC_CHECK_VERSION(4,8)
/* std::map::emplace() not available; this hack uses the move
constructor */
auto
e
=
connections
.
insert
(
std
::
make_pair
(
key
,
ManagedConnection
(
*
this
,
loop
,
server
,
export_name
)));
#else
auto
e
=
connections
.
emplace
(
std
::
piecewise_construct
,
std
::
forward_as_tuple
(
key
),
std
::
forward_as_tuple
(
*
this
,
loop
,
server
,
export_name
));
#endif
return
e
.
first
->
second
;
}
src/lib/nfs/Manager.hxx
View file @
eb8fd079
...
...
@@ -41,6 +41,13 @@ class NfsManager {
:
NfsConnection
(
_loop
,
_server
,
_export_name
),
manager
(
_manager
)
{}
#if defined(__GNUC__) && !defined(__clang__) && !GCC_CHECK_VERSION(4,8)
/* needed due to lack of std::map::emplace() */
ManagedConnection
(
ManagedConnection
&&
other
)
:
NfsConnection
(
std
::
move
(
other
)),
manager
(
other
.
manager
)
{}
#endif
protected
:
/* virtual methods from NfsConnection */
void
OnNfsConnectionError
(
Error
&&
error
)
override
;
...
...
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