" -b <buffer> request alternate ring buffers (can use multiple)\n"
" ('main', 'radio', 'system', 'apps', 'kmsg', 'syslog')\n"
" the default set is main + system + apps\n"
- " -u <size> Sets the initial size of sort buffer (0 to disable sorting)\n"
+ " -u <size> Sets the size of sort buffer (0 to disable sorting)\n"
" Smaller is faster but lowers sorting quality\n"
" --pid <pid> Filter messages by process id\n"
" --tid <tid> Filter messages by thread id\n"
return logs->size - logs->begin + logs->end;
}
-int sort_vector_enlarge(struct sort_vector *logs)
-{
- assert(logs);
- assert(IS_VECTOR_SIZE_SORTABLE(logs->size));
-
- const int old_size = logs->size;
- const int new_size = 2 * old_size;
-
- typeof(logs->data) result = (typeof(logs->data))realloc(logs->data, new_size * sizeof *logs->data);
- if (result == NULL)
- return -ENOMEM;
-
- memset(result + old_size, 0x00, (new_size - old_size) * sizeof *result);
- if (logs->end < logs->begin) {
- const size_t end_bytes = logs->end * sizeof *result;
- memmove(result + old_size, result, end_bytes);
- memset(result, 0x00, end_bytes);
- logs->end += old_size;
- }
-
- logs->data = result;
- logs->size = new_size;
-
- return 0;
-}
-
/**
* @brief Push log
* @details Push a log to the sorting container
return -EPERM;
}
- if (sort_vector_full(logs) && (sort_vector_enlarge(logs) < 0)) {
+ if (sort_vector_full(logs)) {
logfile_write_with_rotation(sort_vector_back(logs), l_file);
sort_vector_pop(logs);
}