Rename {dual,triple}_timestamp_get to {dual,triple}_timestamp_now

Those functions take a pointer to a timestamp and return a timestamp pointer,
so the reader would be justified to think that those are just getters. Rename
them to avoid confusion.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2023-11-13 13:27:07 +01:00
parent 6f510ec8d6
commit fa5a025167
31 changed files with 46 additions and 46 deletions
+1 -1
View File
@@ -4612,7 +4612,7 @@ static int process_epoll(sd_event *e, usec_t timeout, int64_t threshold, int64_t
/* Set timestamp only when this is called first time. */
if (threshold == INT64_MAX)
triple_timestamp_get(&e->timestamp);
triple_timestamp_now(&e->timestamp);
for (size_t i = 0; i < m; i++) {
+1 -1
View File
@@ -2530,7 +2530,7 @@ int journal_file_append_entry(
"Invalid monotomic timestamp %" PRIu64 ", refusing entry.",
ts->monotonic);
} else {
dual_timestamp_get(&_ts);
dual_timestamp_now(&_ts);
ts = &_ts;
}
@@ -27,7 +27,7 @@ static int journal_append_message(JournalFile *mj, const char *message) {
assert(mj);
assert(message);
dual_timestamp_get(&ts);
dual_timestamp_now(&ts);
iovec = IOVEC_MAKE_STRING(message);
return journal_file_append_entry(
mj,
@@ -64,7 +64,7 @@ static void append_number(JournalFile *f, int n, const sd_id128_t *boot_id, uint
struct iovec iovec[2];
size_t n_iov = 0;
dual_timestamp_get(&ts);
dual_timestamp_now(&ts);
if (ts.monotonic <= previous_ts.monotonic)
ts.monotonic = previous_ts.monotonic + 1;
@@ -85,7 +85,7 @@ static void run_test(void) {
dual_timestamp ts;
struct iovec iovec[2];
dual_timestamp_get(&ts);
dual_timestamp_now(&ts);
if (ts.monotonic <= previous_ts.monotonic)
ts.monotonic = previous_ts.monotonic + 1;
@@ -108,7 +108,7 @@ static int run_test(const char *verification_key, ssize_t max_iterations) {
struct iovec iovec;
struct dual_timestamp ts;
dual_timestamp_get(&ts);
dual_timestamp_now(&ts);
assert_se(asprintf(&test, "RANDOM=%li", random() % RANDOM_RANGE));
iovec = IOVEC_MAKE_STRING(test);
assert_se(journal_file_append_entry(
+2 -2
View File
@@ -41,7 +41,7 @@ static void test_non_empty_one(void) {
assert_se(journal_file_open(-1, "test.journal", O_RDWR|O_CREAT, JOURNAL_COMPRESS|JOURNAL_SEAL, 0666, UINT64_MAX, NULL, m, NULL, &f) == 0);
assert_se(dual_timestamp_get(&ts));
assert_se(dual_timestamp_now(&ts));
assert_se(sd_id128_randomize(&fake_boot_id) == 0);
iovec = IOVEC_MAKE_STRING(test);
@@ -196,7 +196,7 @@ static bool check_compressed(uint64_t compress_threshold, uint64_t data_size) {
assert_se(journal_file_open(-1, "test.journal", O_RDWR|O_CREAT, JOURNAL_COMPRESS|JOURNAL_SEAL, 0666, compress_threshold, NULL, m, NULL, &f) == 0);
dual_timestamp_get(&ts);
dual_timestamp_now(&ts);
iovec = IOVEC_MAKE(data, data_size);
assert_se(journal_file_append_entry(f, &ts, NULL, &iovec, 1, NULL, NULL, NULL, NULL) == 0);