Skip to content

Commit cbb81ac

Browse files
committed
Unqualified use of member variables beginning with an underscore
1 parent 458ec11 commit cbb81ac

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

dev/connection_holder.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ namespace sqlite_orm {
5454
_onAfterOpen{std::move(onAfterOpen)} {}
5555

5656
void retain() {
57-
const maybe_lock maybeLock{this->_sync, !this->_openedForeverHint};
57+
const maybe_lock maybeLock{_sync, !_openedForeverHint};
5858

5959
// `maybeLock.isSynced`: the lock above already synchronized everything, so we can just atomically increment the counter
6060
// `!maybeLock.isSynced`: we presume that the connection is opened once in a single-threaded context [also open forever].
6161
// therefore we can just use an atomic increment but don't need sequencing due to `prevCount > 0`.
62-
if (int prevCount = this->_retain_count.fetch_add(1, std::memory_order_relaxed); prevCount > 0) {
62+
if (int prevCount = _retain_count.fetch_add(1, std::memory_order_relaxed); prevCount > 0) {
6363
return;
6464
}
6565

@@ -70,15 +70,15 @@ namespace sqlite_orm {
7070
throw_translated_sqlite_error(this->db);
7171
}
7272

73-
if (this->_onAfterOpen) {
74-
this->_onAfterOpen(this->db);
73+
if (_onAfterOpen) {
74+
_onAfterOpen(this->db);
7575
}
7676
}
7777

7878
void release() {
79-
const maybe_lock maybeLock{this->_sync, !this->_openedForeverHint};
79+
const maybe_lock maybeLock{_sync, !_openedForeverHint};
8080

81-
if (int prevCount = this->_retain_count.fetch_sub(
81+
if (int prevCount = _retain_count.fetch_sub(
8282
1,
8383
maybeLock.isSynced
8484
// the lock above already synchronized everything, so we can just atomically decrement the counter
@@ -107,7 +107,7 @@ namespace sqlite_orm {
107107
* @attention While retrieving the reference count value is atomic it makes only sense at single-threaded points in code.
108108
*/
109109
int retain_count() const {
110-
return this->_retain_count.load(std::memory_order_relaxed);
110+
return _retain_count.load(std::memory_order_relaxed);
111111
}
112112

113113
const std::string filename;
@@ -136,22 +136,22 @@ namespace sqlite_orm {
136136
// first one opens the connection.
137137
// we presume that the connection is opened once in a single-threaded context [also open forever].
138138
// therefore we can just use an atomic increment but don't need sequencing due to `prevCount > 0`.
139-
if (this->_retain_count.fetch_add(1, std::memory_order_relaxed) == 0) {
139+
if (_retain_count.fetch_add(1, std::memory_order_relaxed) == 0) {
140140
int rc = sqlite3_open(this->filename.c_str(), &this->db);
141141
if (rc != SQLITE_OK) SQLITE_ORM_CPP_UNLIKELY /*possible, but unexpected*/ {
142142
throw_translated_sqlite_error(this->db);
143143
}
144144
}
145145

146-
if (this->_onAfterOpen) {
147-
this->_onAfterOpen(this->db);
146+
if (_onAfterOpen) {
147+
_onAfterOpen(this->db);
148148
}
149149
}
150150

151151
void release() {
152152
// last one closes the connection.
153153
// we assume that this might happen by any thread, therefore the counter must serve as a synchronization point.
154-
if (this->_retain_count.fetch_sub(1, std::memory_order_acq_rel) == 1) {
154+
if (_retain_count.fetch_sub(1, std::memory_order_acq_rel) == 1) {
155155
int rc = sqlite3_close(this->db);
156156
if (rc != SQLITE_OK) SQLITE_ORM_CPP_UNLIKELY {
157157
throw_translated_sqlite_error(this->db);
@@ -170,7 +170,7 @@ namespace sqlite_orm {
170170
* @attention While retrieving the reference count value is atomic it makes only sense at single-threaded points in code.
171171
*/
172172
int retain_count() const {
173-
return this->_retain_count.load(std::memory_order_relaxed);
173+
return _retain_count.load(std::memory_order_relaxed);
174174
}
175175

176176
const std::string filename;

include/sqlite_orm/sqlite_orm.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13931,12 +13931,12 @@ namespace sqlite_orm {
1393113931
_onAfterOpen{std::move(onAfterOpen)} {}
1393213932

1393313933
void retain() {
13934-
const maybe_lock maybeLock{this->_sync, !this->_openedForeverHint};
13934+
const maybe_lock maybeLock{_sync, !_openedForeverHint};
1393513935

1393613936
// `maybeLock.isSynced`: the lock above already synchronized everything, so we can just atomically increment the counter
1393713937
// `!maybeLock.isSynced`: we presume that the connection is opened once in a single-threaded context [also open forever].
1393813938
// therefore we can just use an atomic increment but don't need sequencing due to `prevCount > 0`.
13939-
if (int prevCount = this->_retain_count.fetch_add(1, std::memory_order_relaxed); prevCount > 0) {
13939+
if (int prevCount = _retain_count.fetch_add(1, std::memory_order_relaxed); prevCount > 0) {
1394013940
return;
1394113941
}
1394213942

@@ -13947,15 +13947,15 @@ namespace sqlite_orm {
1394713947
throw_translated_sqlite_error(this->db);
1394813948
}
1394913949

13950-
if (this->_onAfterOpen) {
13951-
this->_onAfterOpen(this->db);
13950+
if (_onAfterOpen) {
13951+
_onAfterOpen(this->db);
1395213952
}
1395313953
}
1395413954

1395513955
void release() {
13956-
const maybe_lock maybeLock{this->_sync, !this->_openedForeverHint};
13956+
const maybe_lock maybeLock{_sync, !_openedForeverHint};
1395713957

13958-
if (int prevCount = this->_retain_count.fetch_sub(
13958+
if (int prevCount = _retain_count.fetch_sub(
1395913959
1,
1396013960
maybeLock.isSynced
1396113961
// the lock above already synchronized everything, so we can just atomically decrement the counter
@@ -13984,7 +13984,7 @@ namespace sqlite_orm {
1398413984
* @attention While retrieving the reference count value is atomic it makes only sense at single-threaded points in code.
1398513985
*/
1398613986
int retain_count() const {
13987-
return this->_retain_count.load(std::memory_order_relaxed);
13987+
return _retain_count.load(std::memory_order_relaxed);
1398813988
}
1398913989

1399013990
const std::string filename;
@@ -14013,22 +14013,22 @@ namespace sqlite_orm {
1401314013
// first one opens the connection.
1401414014
// we presume that the connection is opened once in a single-threaded context [also open forever].
1401514015
// therefore we can just use an atomic increment but don't need sequencing due to `prevCount > 0`.
14016-
if (this->_retain_count.fetch_add(1, std::memory_order_relaxed) == 0) {
14016+
if (_retain_count.fetch_add(1, std::memory_order_relaxed) == 0) {
1401714017
int rc = sqlite3_open(this->filename.c_str(), &this->db);
1401814018
if (rc != SQLITE_OK) SQLITE_ORM_CPP_UNLIKELY /*possible, but unexpected*/ {
1401914019
throw_translated_sqlite_error(this->db);
1402014020
}
1402114021
}
1402214022

14023-
if (this->_onAfterOpen) {
14024-
this->_onAfterOpen(this->db);
14023+
if (_onAfterOpen) {
14024+
_onAfterOpen(this->db);
1402514025
}
1402614026
}
1402714027

1402814028
void release() {
1402914029
// last one closes the connection.
1403014030
// we assume that this might happen by any thread, therefore the counter must serve as a synchronization point.
14031-
if (this->_retain_count.fetch_sub(1, std::memory_order_acq_rel) == 1) {
14031+
if (_retain_count.fetch_sub(1, std::memory_order_acq_rel) == 1) {
1403214032
int rc = sqlite3_close(this->db);
1403314033
if (rc != SQLITE_OK) SQLITE_ORM_CPP_UNLIKELY {
1403414034
throw_translated_sqlite_error(this->db);
@@ -14047,7 +14047,7 @@ namespace sqlite_orm {
1404714047
* @attention While retrieving the reference count value is atomic it makes only sense at single-threaded points in code.
1404814048
*/
1404914049
int retain_count() const {
14050-
return this->_retain_count.load(std::memory_order_relaxed);
14050+
return _retain_count.load(std::memory_order_relaxed);
1405114051
}
1405214052

1405314053
const std::string filename;

0 commit comments

Comments
 (0)