mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-01 10:46:45 +02:00
modularize string arrays for line completion
Instead of using various different forms of string arrays and having to handle them differently for string completion, we now always use char pointer arrays. This allows us to remove some large stack allocations, remove a bunch of confusing defines that keep track of global array sizes, and generally unclutters the code so it's easier to read.
This commit is contained in:
@ -37,6 +37,7 @@ extern FriendsList Friends;
|
||||
|
||||
/* number of "#"'s in file transfer progress bar. Keep well below MAX_STR_SIZE */
|
||||
#define NUM_PROG_MARKS 50
|
||||
#define STR_BUF_SIZE 30
|
||||
|
||||
/* creates initial progress line that will be updated during file transfer.
|
||||
Assumes progline has room for at least MAX_STR_SIZE bytes */
|
||||
@ -59,10 +60,10 @@ void print_progress_bar(ToxWindow *self, double bps, double pct_done, uint32_t l
|
||||
return;
|
||||
}
|
||||
|
||||
char pct_str[24];
|
||||
char pct_str[STR_BUF_SIZE] = {0};
|
||||
snprintf(pct_str, sizeof(pct_str), "%.1f%%", pct_done);
|
||||
|
||||
char bps_str[24];
|
||||
char bps_str[STR_BUF_SIZE] = {0};
|
||||
bytes_convert_str(bps_str, sizeof(bps_str), bps);
|
||||
|
||||
char prog_line[NUM_PROG_MARKS + 1] = {0};
|
||||
|
Reference in New Issue
Block a user