mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
add itoa(), replace snprintf("%d") calls
we can save some space and still end up with a 20% faster function Change-Id: Ia58900122944b8527ef01a673afe18ea794acb41
This commit is contained in:
parent
9e61d53c7c
commit
f55fe21f66
9 changed files with 98 additions and 41 deletions
|
@ -239,6 +239,15 @@ static const char * const tag_type_str[] = {
|
|||
#define logf_clauses logf
|
||||
#endif /* ndef LOGF_ENABLE */
|
||||
|
||||
#if !defined(itoa)
|
||||
char *itoa(char *buf, size_t bufsz, long int i)
|
||||
{
|
||||
snprintf(buf, bufsz, "%ld", i);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Status information of the tagcache. */
|
||||
static struct tagcache_stat tc_stat;
|
||||
|
||||
|
@ -1912,7 +1921,7 @@ static bool get_next(struct tagcache_search *tcs, bool is_numeric, char *buf, lo
|
|||
|
||||
if (is_numeric)
|
||||
{
|
||||
snprintf(buf, bufsz, "%ld", tcs->position);
|
||||
itoa(buf, bufsz, tcs->position);
|
||||
tcs->result = buf;
|
||||
tcs->result_len = strlen(buf) + 1;
|
||||
return true;
|
||||
|
@ -3982,7 +3991,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs)
|
|||
{
|
||||
if (TAGCACHE_IS_NUMERIC(j))
|
||||
{
|
||||
snprintf(temp, sizeof temp, "%d", (int)idx.tag_seek[j]);
|
||||
itoa(temp, sizeof temp, (int)idx.tag_seek[j]);
|
||||
write_tag(clfd, tagcache_tag_to_str(j), temp);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue