Skip to content

Commit 79174b2

Browse files
committed
use c++-style references
1 parent 5063e61 commit 79174b2

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

libc/src/time/linux/localtime_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void release_file(ErrorOr<File *> error_or_file) {
1919
error_or_file.value()->close();
2020
}
2121

22-
ErrorOr<File *> acquire_file(char *filename) {
22+
ErrorOr<File *> acquire_file(char& filename) {
2323
while (1) {
2424
if (file_usage == 0) {
2525
file_usage = 1;
@@ -30,7 +30,7 @@ ErrorOr<File *> acquire_file(char *filename) {
3030
return LIBC_NAMESPACE::openfile(filename, "rb");
3131
}
3232

33-
timezone::tzset *get_localtime(struct tm *tm) {
33+
timezone::tzset& get_localtime(struct tm& tm) {
3434
(void)tm;
3535
return nullptr;
3636
}

libc/src/time/linux/localtime_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LIBC_INLINE volatile int file_usage;
1919
namespace LIBC_NAMESPACE_DECL {
2020
namespace localtime_utils {
2121

22-
timezone::tzset *get_localtime(struct tm *tm);
22+
timezone::tzset& get_localtime(struct tm& tm);
2323

2424
} // namespace localtime_utils
2525
} // namespace LIBC_NAMESPACE_DECL

libc/src/time/linux/timezone.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace LIBC_NAMESPACE_DECL {
1414
namespace timezone {
1515

16-
tzset *get_tzset(File *file) {
16+
tzset& get_tzset(File& file) {
1717
static tzset result;
1818
(void)file;
1919

libc/src/time/linux/timezone.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ typedef struct {
2929

3030
// additional fields
3131
int64_t offsets;
32-
size_t *size;
32+
size_t& size;
3333
} ttinfo;
3434

3535
typedef struct {
@@ -39,18 +39,18 @@ typedef struct {
3939
uint64_t tzh_timecnt;
4040
uint64_t tzh_typecnt;
4141
uint64_t tzh_charcnt;
42-
ttinfo *ttinfo;
42+
ttinfo& ttinfo;
4343

4444
// additional fields
45-
int64_t *tzh_timecnt_transitions;
46-
int64_t *tzh_timecnt_indices;
45+
int64_t& tzh_timecnt_transitions;
46+
int64_t& tzh_timecnt_indices;
4747
size_t tzh_timecnt_number_transitions;
48-
int64_t *tz;
48+
int64_t& tz;
4949
int8_t global_offset;
5050
int8_t global_isdst;
5151
} tzset;
5252

53-
tzset *get_tzset(::FILE *file);
53+
tzset& get_tzset(::FILE& file);
5454

5555
} // namespace timezone
5656
} // namespace LIBC_NAMESPACE_DECL

libc/src/time/time_utils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,19 @@ LIBC_INLINE tm *localtime(const time_t *t_ptr) {
106106
return time_utils::gmtime_internal(t_ptr, &result);
107107
}
108108

109-
LIBC_INLINE struct tm *localtime_internal(const time_t *timer, struct tm *buf) {
109+
LIBC_INLINE struct tm *localtime_internal(const time_t& timer, struct tm& buf) {
110110
if (timer == nullptr) {
111111
invalid_value();
112112
return nullptr;
113113
}
114114

115115
// Update the tm structure's year, month, day, etc. from seconds.
116-
if (update_from_seconds(static_cast<int64_t>(*timer), buf) < 0) {
116+
if (update_from_seconds(static_cast<int64_t>(timer), &buf) < 0) {
117117
out_of_range();
118118
return nullptr;
119119
}
120120

121-
return buf;
121+
return &buf;
122122
}
123123

124124
// Returns number of years from (1, year).

0 commit comments

Comments
 (0)