Skip to content

Commit a5fbada

Browse files
clang-format
1 parent 4c9e7f3 commit a5fbada

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

flang-rt/include/flang-rt/runtime/environment.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ struct ExecutionEnvironment {
4545
const char *GetEnv(
4646
const char *name, std::size_t name_length, const Terminator &terminator);
4747

48-
std::int32_t SetEnv(
49-
const char *name, std::size_t name_length,
48+
std::int32_t SetEnv(const char *name, std::size_t name_length,
5049
const char *value, std::size_t value_length,
5150
const Terminator &terminator);
5251

5352
std::int32_t UnsetEnv(
54-
const char *name, std::size_t name_length,
55-
const Terminator &terminator);
53+
const char *name, std::size_t name_length, const Terminator &terminator);
5654

5755
int argc{0};
5856
const char **argv{nullptr};

flang-rt/lib/runtime/command.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,10 @@ std::int32_t RTNAME(PutEnv)(
339339
if (str_sep == str_end) {
340340
// No separator, invalid input string
341341
status = EINVAL;
342-
}
343-
else if ((str_sep + 1) == str_end) {
342+
} else if ((str_sep + 1) == str_end) {
344343
// "name=" form, which means we need to delete this variable
345344
status = executionEnvironment.UnsetEnv(str, str_sep - str, terminator);
346-
}
347-
else {
345+
} else {
348346
// Example: consider str "abc=defg", str_length = 8
349347
//
350348
// addr: 05 06 07 08 09 10 11 12 13
@@ -354,7 +352,7 @@ std::int32_t RTNAME(PutEnv)(
354352
// value ptr: str_sep + 1 = 9, value length: 4
355353
//
356354
status = executionEnvironment.SetEnv(
357-
str, str_sep - str, str_sep + 1, str_end - str_sep - 1, terminator);
355+
str, str_sep - str, str_sep + 1, str_end - str_sep - 1, terminator);
358356
}
359357

360358
return status;

flang-rt/lib/runtime/environment.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,9 @@ const char *ExecutionEnvironment::GetEnv(
182182
return std::getenv(cStyleName.get());
183183
}
184184

185-
std::int32_t ExecutionEnvironment::SetEnv(
186-
const char *name, std::size_t name_length,
187-
const char *value, std::size_t value_length,
188-
const Terminator &terminator) {
185+
std::int32_t ExecutionEnvironment::SetEnv(const char *name,
186+
std::size_t name_length, const char *value, std::size_t value_length,
187+
const Terminator &terminator) {
189188

190189
RUNTIME_CHECK(terminator, name && name_length && value && value_length);
191190

@@ -210,17 +209,15 @@ std::int32_t ExecutionEnvironment::SetEnv(
210209

211210
#endif
212211

213-
if (status != 0)
214-
{
212+
if (status != 0) {
215213
status = errno;
216214
}
217215

218216
return status;
219217
}
220218

221219
std::int32_t ExecutionEnvironment::UnsetEnv(
222-
const char *name, std::size_t name_length,
223-
const Terminator &terminator) {
220+
const char *name, std::size_t name_length, const Terminator &terminator) {
224221

225222
RUNTIME_CHECK(terminator, name && name_length);
226223

@@ -241,8 +238,7 @@ std::int32_t ExecutionEnvironment::UnsetEnv(
241238

242239
#endif
243240

244-
if (status != 0)
245-
{
241+
if (status != 0) {
246242
status = errno;
247243
}
248244

0 commit comments

Comments
 (0)