Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
227d0177
Commit
227d0177
authored
May 24, 2012
by
JINMEI Tatuya
Browse files
[1704] style matters: long line, () for return, const, { position.
also change 'const string' to 'const string&' in some places
parent
30198a34
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/lib/log/logger_impl.h
View file @
227d0177
...
...
@@ -186,8 +186,8 @@ public:
}
private:
std
::
string
name_
;
///< Full name of this logger
log4cplus
::
Logger
logger_
;
///< Underlying log4cplus logger
std
::
string
name_
;
///< Full name of this logger
log4cplus
::
Logger
logger_
;
///< Underlying log4cplus logger
isc
::
util
::
InterprocessSync
*
sync_
;
};
...
...
src/lib/log/tests/logger_unittest.cc
View file @
227d0177
...
...
@@ -386,31 +386,32 @@ TEST_F(LoggerTest, LoggerNameLength) {
class
MockSync
:
public
isc
::
util
::
InterprocessSync
{
public:
/// \brief Constructor
MockSync
(
const
std
::
string
component_name
)
:
InterprocessSync
(
component_name
),
was_locked_
(
false
),
was_unlocked_
(
false
)
MockSync
(
const
std
::
string
&
component_name
)
:
InterprocessSync
(
component_name
),
was_locked_
(
false
),
was_unlocked_
(
false
)
{}
bool
wasLocked
()
const
{
return
was_locked_
;
return
(
was_locked_
)
;
}
bool
wasUnlocked
()
const
{
return
was_unlocked_
;
return
(
was_unlocked_
)
;
}
protected:
bool
lock
()
{
was_locked_
=
true
;
return
true
;
return
(
true
)
;
}
bool
tryLock
()
{
return
true
;
return
(
true
)
;
}
bool
unlock
()
{
was_unlocked_
=
true
;
return
true
;
return
(
true
)
;
}
private:
...
...
@@ -427,7 +428,7 @@ TEST_F(LoggerTest, Lock) {
// Setup our own mock sync object so that we can intercept the lock
// call and check if a lock has been taken.
MockSync
*
sync
=
new
MockSync
(
"logger"
);
MockSync
*
sync
=
new
MockSync
(
"logger"
);
logger
.
setInterprocessSync
(
sync
);
// Log a message and put things into play.
...
...
src/lib/util/interprocess_sync.h
View file @
227d0177
...
...
@@ -28,7 +28,7 @@ public:
/// \brief Constructor
///
/// Creates a interprocess synchronization object
InterprocessSync
(
const
std
::
string
component_name
)
:
InterprocessSync
(
const
std
::
string
&
component_name
)
:
component_name_
(
component_name
),
is_locked_
(
false
)
{}
...
...
@@ -40,7 +40,7 @@ protected:
virtual
bool
tryLock
()
=
0
;
virtual
bool
unlock
()
=
0
;
std
::
string
component_name_
;
const
std
::
string
component_name_
;
bool
is_locked_
;
};
...
...
@@ -56,15 +56,15 @@ public:
}
bool
lock
()
{
return
sync_
.
lock
();
return
(
sync_
.
lock
()
)
;
}
bool
tryLock
()
{
return
sync_
.
tryLock
();
return
(
sync_
.
tryLock
()
)
;
}
bool
unlock
()
{
return
sync_
.
unlock
();
return
(
sync_
.
unlock
()
)
;
}
protected:
...
...
src/lib/util/interprocess_sync_file.cc
View file @
227d0177
...
...
@@ -36,8 +36,7 @@ InterprocessSyncFile::~InterprocessSyncFile() {
}
bool
InterprocessSyncFile
::
do_lock
(
int
cmd
,
short
l_type
)
{
InterprocessSyncFile
::
do_lock
(
int
cmd
,
short
l_type
)
{
// Open lock file only when necessary (i.e., here). This is so that
// if a default InterprocessSync object is replaced with another
// implementation, it doesn't attempt any opens.
...
...
src/lib/util/interprocess_sync_file.h
View file @
227d0177
...
...
@@ -35,7 +35,7 @@ public:
class
InterprocessSyncFile
:
public
InterprocessSync
{
public:
/// \brief Constructor
InterprocessSyncFile
(
const
std
::
string
component_name
)
:
InterprocessSyncFile
(
const
std
::
string
&
component_name
)
:
InterprocessSync
(
component_name
),
fd_
(
-
1
)
{}
...
...
src/lib/util/tests/interprocess_sync_file_unittest.cc
View file @
227d0177
...
...
@@ -65,7 +65,7 @@ TEST(InterprocessSyncFileTest, TestLock) {
tv
.
tv_sec
=
5
;
tv
.
tv_usec
=
0
;
int
nfds
=
select
(
fds
[
0
]
+
1
,
&
rfds
,
NULL
,
NULL
,
&
tv
);
const
int
nfds
=
select
(
fds
[
0
]
+
1
,
&
rfds
,
NULL
,
NULL
,
&
tv
);
EXPECT_EQ
(
1
,
nfds
);
if
(
nfds
==
1
)
{
...
...
@@ -133,7 +133,7 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) {
tv
.
tv_sec
=
5
;
tv
.
tv_usec
=
0
;
int
nfds
=
select
(
fds
[
0
]
+
1
,
&
rfds
,
NULL
,
NULL
,
&
tv
);
const
int
nfds
=
select
(
fds
[
0
]
+
1
,
&
rfds
,
NULL
,
NULL
,
&
tv
);
EXPECT_EQ
(
1
,
nfds
);
if
(
nfds
==
1
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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