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
a65d02d3
Commit
a65d02d3
authored
Aug 20, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system/FileDescriptor: add "noexcept"
parent
2156fc64
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
19 deletions
+20
-19
FileDescriptor.cxx
src/system/FileDescriptor.cxx
+1
-1
FileDescriptor.hxx
src/system/FileDescriptor.hxx
+6
-6
UniqueFileDescriptor.hxx
src/system/UniqueFileDescriptor.hxx
+13
-12
No files found.
src/system/FileDescriptor.cxx
View file @
a65d02d3
/*
* Copyright
(C) 2012-2017
Max Kellermann <max.kellermann@gmail.com>
* Copyright
2012-2018
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
src/system/FileDescriptor.hxx
View file @
a65d02d3
/*
* Copyright
(C) 2012-2017
Max Kellermann <max.kellermann@gmail.com>
* Copyright
2012-2018
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -59,13 +59,13 @@ protected:
public
:
FileDescriptor
()
=
default
;
explicit
constexpr
FileDescriptor
(
int
_fd
)
:
fd
(
_fd
)
{}
explicit
constexpr
FileDescriptor
(
int
_fd
)
noexcept
:
fd
(
_fd
)
{}
constexpr
bool
operator
==
(
FileDescriptor
other
)
const
{
constexpr
bool
operator
==
(
FileDescriptor
other
)
const
noexcept
{
return
fd
==
other
.
fd
;
}
constexpr
bool
IsDefined
()
const
{
constexpr
bool
IsDefined
()
const
noexcept
{
return
fd
>=
0
;
}
...
...
@@ -93,7 +93,7 @@ public:
* Returns the file descriptor. This may only be called if
* IsDefined() returns true.
*/
constexpr
int
Get
()
const
{
constexpr
int
Get
()
const
noexcept
{
return
fd
;
}
...
...
@@ -109,7 +109,7 @@ public:
fd
=
-
1
;
}
static
constexpr
FileDescriptor
Undefined
()
{
static
constexpr
FileDescriptor
Undefined
()
noexcept
{
return
FileDescriptor
(
-
1
);
}
...
...
src/system/UniqueFileDescriptor.hxx
View file @
a65d02d3
/*
* Copyright
(C) 2012-2017
Max Kellermann <max.kellermann@gmail.com>
* Copyright
2012-2018
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -39,25 +39,26 @@
*/
class
UniqueFileDescriptor
:
protected
FileDescriptor
{
public
:
UniqueFileDescriptor
()
:
FileDescriptor
(
FileDescriptor
::
Undefined
())
{}
UniqueFileDescriptor
()
noexcept
:
FileDescriptor
(
FileDescriptor
::
Undefined
())
{}
protected
:
explicit
UniqueFileDescriptor
(
int
_fd
)
:
FileDescriptor
(
_fd
)
{
explicit
UniqueFileDescriptor
(
int
_fd
)
noexcept
:
FileDescriptor
(
_fd
)
{
assert
(
IsDefined
());
}
public
:
explicit
UniqueFileDescriptor
(
FileDescriptor
_fd
)
explicit
UniqueFileDescriptor
(
FileDescriptor
_fd
)
noexcept
:
FileDescriptor
(
_fd
)
{}
UniqueFileDescriptor
(
UniqueFileDescriptor
&&
other
)
UniqueFileDescriptor
(
UniqueFileDescriptor
&&
other
)
noexcept
:
FileDescriptor
(
other
.
Steal
())
{}
~
UniqueFileDescriptor
()
{
~
UniqueFileDescriptor
()
noexcept
{
Close
();
}
UniqueFileDescriptor
&
operator
=
(
UniqueFileDescriptor
&&
other
)
{
UniqueFileDescriptor
&
operator
=
(
UniqueFileDescriptor
&&
other
)
noexcept
{
std
::
swap
(
fd
,
other
.
fd
);
return
*
this
;
}
...
...
@@ -65,7 +66,7 @@ public:
/**
* Convert this object to its #FileDescriptor base type.
*/
const
FileDescriptor
&
ToFileDescriptor
()
const
{
const
FileDescriptor
&
ToFileDescriptor
()
const
noexcept
{
return
*
this
;
}
...
...
@@ -77,7 +78,7 @@ public:
using
FileDescriptor
::
Steal
;
protected
:
void
Set
(
int
_fd
)
{
void
Set
(
int
_fd
)
noexcept
{
assert
(
!
IsDefined
());
assert
(
_fd
>=
0
);
...
...
@@ -91,7 +92,7 @@ public:
#ifndef _WIN32
using
FileDescriptor
::
OpenNonBlocking
;
static
bool
CreatePipe
(
UniqueFileDescriptor
&
r
,
UniqueFileDescriptor
&
w
)
{
static
bool
CreatePipe
(
UniqueFileDescriptor
&
r
,
UniqueFileDescriptor
&
w
)
noexcept
{
return
FileDescriptor
::
CreatePipe
(
r
,
w
);
}
...
...
@@ -100,7 +101,7 @@ public:
using
FileDescriptor
::
Duplicate
;
using
FileDescriptor
::
CheckDuplicate
;
static
bool
CreatePipe
(
FileDescriptor
&
r
,
FileDescriptor
&
w
);
static
bool
CreatePipe
(
FileDescriptor
&
r
,
FileDescriptor
&
w
)
noexcept
;
#endif
using
FileDescriptor
::
EnableCloseOnExec
;
...
...
@@ -118,7 +119,7 @@ public:
using
FileDescriptor
::
CreateInotify
;
#endif
bool
Close
()
{
bool
Close
()
noexcept
{
return
IsDefined
()
&&
FileDescriptor
::
Close
();
}
...
...
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