core: Avoid trivial snprintfs.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 34m10s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 34m10s
This commit is contained in:
@ -102,7 +102,7 @@ static ebt_entry_t* _ebt_get_entry(tf_ssb_ebt_t* ebt, const char* id)
|
||||
.in = -1,
|
||||
.out = -1,
|
||||
};
|
||||
snprintf(ebt->entries[index].id, sizeof(ebt->entries[index].id), "%s", id);
|
||||
tf_string_set(ebt->entries[index].id, sizeof(ebt->entries[index].id), id);
|
||||
ebt->entries_count++;
|
||||
return &ebt->entries[index];
|
||||
}
|
||||
@ -212,7 +212,7 @@ static void _ebt_add_to_clock(ebt_get_clock_t* work, const char* id, int64_t val
|
||||
memmove(work->clock->entries + index + 1, work->clock->entries + index, (count - index) * sizeof(tf_ssb_ebt_clock_entry_t));
|
||||
}
|
||||
work->clock->entries[index] = (tf_ssb_ebt_clock_entry_t) { .value = out_value };
|
||||
snprintf(work->clock->entries[index].id, sizeof(work->clock->entries[index].id), "%s", id);
|
||||
tf_string_set(work->clock->entries[index].id, sizeof(work->clock->entries[index].id), id);
|
||||
work->clock->count = count + 1;
|
||||
}
|
||||
}
|
||||
@ -279,7 +279,7 @@ static void _tf_ssb_ebt_get_send_clock_work(tf_ssb_connection_t* connection, voi
|
||||
{
|
||||
requested = tf_resize_vec(requested, (requested_count + 1) * sizeof(tf_ssb_ebt_clock_entry_t));
|
||||
requested[requested_count] = (tf_ssb_ebt_clock_entry_t) { .value = -1 };
|
||||
snprintf(requested[requested_count].id, sizeof(requested[requested_count].id), "%s", entry->id);
|
||||
tf_string_set(requested[requested_count].id, sizeof(requested[requested_count].id), entry->id);
|
||||
requested_count++;
|
||||
}
|
||||
}
|
||||
@ -342,7 +342,7 @@ tf_ssb_ebt_clock_t* tf_ssb_ebt_get_messages_to_send(tf_ssb_ebt_t* ebt)
|
||||
{
|
||||
clock = tf_resize_vec(clock, sizeof(tf_ssb_ebt_clock_t) + (count + 1) * sizeof(tf_ssb_ebt_clock_entry_t));
|
||||
clock->entries[count] = (tf_ssb_ebt_clock_entry_t) { .value = entry->in };
|
||||
snprintf(clock->entries[count].id, sizeof(clock->entries[count].id), "%s", entry->id);
|
||||
tf_string_set(clock->entries[count].id, sizeof(clock->entries[count].id), entry->id);
|
||||
clock->count = ++count;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user