File tree Expand file tree Collapse file tree 7 files changed +10
-9
lines changed Expand file tree Collapse file tree 7 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ namespace ipc {
45
45
namespace shm {
46
46
47
47
id_t acquire (char const * name, std::size_t size, unsigned mode) {
48
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
48
+ if (! is_valid_string ( name) ) {
49
49
ipc::error (" fail acquire: name is empty\n " );
50
50
return nullptr ;
51
51
}
@@ -185,7 +185,7 @@ void remove(id_t id) {
185
185
}
186
186
187
187
void remove (char const * name) {
188
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
188
+ if (! is_valid_string ( name) ) {
189
189
ipc::error (" fail remove: name is empty\n " );
190
190
return ;
191
191
}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ namespace ipc {
28
28
namespace shm {
29
29
30
30
id_t acquire (char const * name, std::size_t size, unsigned mode) {
31
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
31
+ if (! is_valid_string ( name) ) {
32
32
ipc::error (" fail acquire: name is empty\n " );
33
33
return nullptr ;
34
34
}
@@ -124,7 +124,7 @@ void remove(id_t id) {
124
124
}
125
125
126
126
void remove (char const * name) {
127
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
127
+ if (! is_valid_string ( name) ) {
128
128
ipc::error (" fail remove: name is empty\n " );
129
129
return ;
130
130
}
Original file line number Diff line number Diff line change 18
18
#include " libipc/utility/log.h"
19
19
#include " libipc/platform/detail.h"
20
20
#include " libipc/circ/elem_def.h"
21
+ #include " libipc/memory/resource.h"
21
22
22
23
namespace ipc {
23
24
namespace detail {
@@ -29,7 +30,7 @@ class queue_conn {
29
30
30
31
template <typename Elems>
31
32
Elems* open (char const * name) {
32
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
33
+ if (! is_valid_string ( name) ) {
33
34
ipc::error (" fail open waiter: name is empty!\n " );
34
35
return nullptr ;
35
36
}
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ void handle::sub_ref() noexcept {
69
69
}
70
70
71
71
bool handle::acquire (char const * name, std::size_t size, unsigned mode) {
72
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
72
+ if (! is_valid_string ( name) ) {
73
73
ipc::error (" fail acquire: name is empty\n " );
74
74
return false ;
75
75
}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ bool condition::valid() const noexcept {
50
50
}
51
51
52
52
bool condition::open (char const *name) noexcept {
53
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
53
+ if (! is_valid_string ( name) ) {
54
54
ipc::error (" fail condition open: name is empty\n " );
55
55
return false ;
56
56
}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ bool mutex::valid() const noexcept {
50
50
}
51
51
52
52
bool mutex::open (char const *name) noexcept {
53
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
53
+ if (! is_valid_string ( name) ) {
54
54
ipc::error (" fail mutex open: name is empty\n " );
55
55
return false ;
56
56
}
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ bool semaphore::valid() const noexcept {
48
48
}
49
49
50
50
bool semaphore::open (char const *name, std::uint32_t count) noexcept {
51
- if (name == nullptr || name[ 0 ] == ' \0 ' ) {
51
+ if (! is_valid_string ( name) ) {
52
52
ipc::error (" fail semaphore open: name is empty\n " );
53
53
return false ;
54
54
}
You can’t perform that action at this time.
0 commit comments