File tree Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -119,25 +119,23 @@ bool Flag::init() {
119
119
#else // !_WIN32
120
120
#ifdef __APPLE__
121
121
char ** environ = *_NSGetEnviron ();
122
+ #endif // __APPLE__
123
+
122
124
if (environ == NULL ) {
123
125
return false ;
124
126
}
125
- #endif // __APPLE__
127
+ for (const char ** p = const_cast <const char **>(environ); *p != NULL ; ++p) {
128
+ std::string var = *p;
129
+ size_t pos = var.find (' =' );
130
+ if ((pos == std::string::npos) || ((pos + 1 ) > var.size ())) {
131
+ continue ;
132
+ }
126
133
127
- if (environ != NULL ) {
128
- for (const char ** p = const_cast <const char **>(environ); *p != NULL ; ++p) {
129
- std::string var = *p;
130
- size_t pos = var.find (' =' );
131
- if ((pos == std::string::npos) || ((pos + 1 ) > var.size ())) {
132
- continue ;
133
- }
134
-
135
- std::string name = var.substr (0 , pos);
136
- if ((pos + 1 ) == var.size ()) {
137
- vars.insert (std::make_pair (name, " " ));
138
- } else {
139
- vars.insert (std::make_pair (name, &(*p)[pos + 1 ]));
140
- }
134
+ std::string name = var.substr (0 , pos);
135
+ if ((pos + 1 ) == var.size ()) {
136
+ vars.insert (std::make_pair (name, " " ));
137
+ } else {
138
+ vars.insert (std::make_pair (name, &(*p)[pos + 1 ]));
141
139
}
142
140
}
143
141
#endif // !_WIN32
You can’t perform that action at this time.
0 commit comments