Skip to content

Commit 498bd97

Browse files
author
Зишан Мирза
committed
format code with clang-format
1 parent e0da6dc commit 498bd97

File tree

10 files changed

+34
-30
lines changed

10 files changed

+34
-30
lines changed

libc/src/time/baremetal/localtime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ namespace LIBC_NAMESPACE_DECL {
1616
extern "C" bool __llvm_libc_localtime_utc(struct timespec *ts);
1717

1818
LLVM_LIBC_FUNCTION(int, localtime, (struct timespec * ts, int base)) {
19-
(void)ts;
20-
return base;
19+
(void)ts;
20+
return base;
2121
}
2222

2323
} // namespace LIBC_NAMESPACE_DECL

libc/src/time/ctime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ LLVM_LIBC_FUNCTION(char *, ctime, (const time_t *t_ptr)) {
2020
return nullptr;
2121
}
2222
static char buffer[TimeConstants::ASCTIME_BUFFER_SIZE];
23-
return time_utils::asctime(time_utils::localtime_internal(t_ptr, &tm_out), buffer,
24-
TimeConstants::ASCTIME_MAX_BYTES);
23+
return time_utils::asctime(time_utils::localtime_internal(t_ptr, &tm_out),
24+
buffer, TimeConstants::ASCTIME_MAX_BYTES);
2525
}
2626

2727
} // namespace LIBC_NAMESPACE_DECL

libc/src/time/linux/localtime.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//===-- Linux implementation of the localtime function ------------------------===//
1+
//===-- Linux implementation of the localtime function
2+
//------------------------===//
23
//
34
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,7 +11,8 @@
1011

1112
namespace LIBC_NAMESPACE_DECL {
1213

13-
LLVM_LIBC_FUNCTION(struct tm *, localtime, (const time_t *timer, struct tm *buf)) {
14+
LLVM_LIBC_FUNCTION(struct tm *, localtime,
15+
(const time_t *timer, struct tm *buf)) {
1416
static struct tm *buf;
1517

1618
if (timer == nullptr) {

libc/src/time/time_utils.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,20 @@ void acquire_file(char *filename) {
4747
}
4848

4949
char *get_env_var(const char *input) {
50-
for (char **env = environ; *env != NULL; ++env) {
51-
char *env_var = *env;
50+
for (char **env = environ; *env != NULL; ++env) {
51+
char *env_var = *env;
5252

53-
int i = 0;
54-
while (input[i] != '\0' && env_var[i] == input[i]) {
55-
i++;
56-
}
53+
int i = 0;
54+
while (input[i] != '\0' && env_var[i] == input[i]) {
55+
i++;
56+
}
5757

58-
if (input[i] == '\0' && env_var[i] == '=') {
59-
return env_var + i + 1;
60-
}
58+
if (input[i] == '\0' && env_var[i] == '=') {
59+
return env_var + i + 1;
6160
}
61+
}
6262

63-
return NULL;
63+
return NULL;
6464
}
6565

6666
// First, divide "total_seconds" by the number of seconds in a day to get the
@@ -231,8 +231,10 @@ timezone::tzset *get_localtime(struct tm *tm) {
231231

232232
for (size_t i = 0; i < *ptr_tzset->ttinfo->size; i++) {
233233
if (is_dst(tm) == ptr_tzset->ttinfo[i].tt_isdst) {
234-
ptr_tzset->global_offset = static_cast<int8_t>(ptr_tzset->ttinfo[i].tt_utoff / 3600);
235-
ptr_tzset->global_isdst = static_cast<int8_t>(ptr_tzset->ttinfo[i].tt_isdst);
234+
ptr_tzset->global_offset =
235+
static_cast<int8_t>(ptr_tzset->ttinfo[i].tt_utoff / 3600);
236+
ptr_tzset->global_isdst =
237+
static_cast<int8_t>(ptr_tzset->ttinfo[i].tt_isdst);
236238
}
237239
}
238240

libc/src/time/time_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ LIBC_INLINE struct tm *localtime_internal(const time_t *timer, struct tm *buf) {
171171
return nullptr;
172172
}
173173

174-
#ifdef LIBC_TARGET_ARCH_IS_X86_64
174+
#ifdef LIBC_TARGET_ARCH_IS_X86_64
175175
timezone::tzset *ptr = get_localtime(buf);
176176
buf->tm_hour += ptr->global_offset;
177177
buf->tm_isdst += ptr->global_isdst;
178-
#endif
178+
#endif
179179

180180
return buf;
181181
}

libc/test/src/time/ctime_r_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ using LIBC_NAMESPACE::time_utils::TimeConstants;
1616
extern char **environ;
1717

1818
void set_env_var(char *env) {
19-
environ[0] = env;
20-
environ[1] = "\0";
19+
environ[0] = env;
20+
environ[1] = "\0";
2121
}
2222

2323
TEST(LlvmLibcCtimeR, Nullptr) {

libc/test/src/time/ctime_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
extern char **environ;
1313

1414
void set_env_var(char *env) {
15-
environ[0] = env;
16-
environ[1] = "\0";
15+
environ[0] = env;
16+
environ[1] = "\0";
1717
}
1818

1919
TEST(LlvmLibcCtime, NULL) {

libc/test/src/time/localtime_r_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
extern char **environ;
1313

1414
void set_env_var(char *env) {
15-
environ[0] = env;
16-
environ[1] = "\0";
15+
environ[0] = env;
16+
environ[1] = "\0";
1717
}
1818

1919
TEST(LlvmLibcLocaltimeR, ValidUnixTimestamp0) {

libc/test/src/time/localtime_s_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
extern char **environ;
1313

1414
void set_env_var(char *env) {
15-
environ[0] = env;
16-
environ[1] = "\0";
15+
environ[0] = env;
16+
environ[1] = "\0";
1717
}
1818

1919
TEST(LlvmLibcLocaltimeS, ValidUnixTimestamp0) {

libc/test/src/time/localtime_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
extern char **environ;
1313

1414
void set_env_var(char *env) {
15-
environ[0] = env;
16-
environ[1] = "\0";
15+
environ[0] = env;
16+
environ[1] = "\0";
1717
}
1818

1919
TEST(LlvmLibcLocaltime, ValidUnixTimestamp0) {

0 commit comments

Comments
 (0)