* id: Handle NULL pointer gracefully within `cstr2cow` macro
> getlogin() returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a NULL pointer if this information cannot be determined.
Ref: https://linux.die.net/man/3/getlogin
* id: Remove redundant std::ffi:: prefix from CStr
* id: Add comment for the null check
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
* id: Remove skip for test that should not segfault anymore
Segfault fixed by 292fb9242342d47412a789f4d0002b811568bd41
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Instead of recreating the formatter over and over again, keep
it pre-parsed in a variable in TimeStyler class.
Also, avoid calling `now` over and over again, that's also slow.
Improves performance by about 6%.
Cache even numerical strings (numeric_uid_gid) in the HashMap,
this makes very little difference performance wise.
However, this allows us to return a reference to a String instead
of making a clone.
Saves about 2-3% on `ls -lR /var/lib .git` (and `ls -lRn`).
Also, add a note that HashMap might not be the most optimal choice.
Easier to reason about than the LazyLock/Mutex encapsulated
static variables.
Performance difference is not measurable, but this drops uneeded
Mutex lock/unlock that were seen in samply output.
We put the out writer and style manager in there, for now.
Reduces the number of parameters to pass around, and we'll add
more useful things in there.
Little to no performance difference.
A lot of custom logic, we basically do arithmetic on character
arrays, but this comes at with huge performance gains.
Unlike coreutils `seq`, we do this for all positive increments
(because why not), and we do not fall back to slow path if
the last parameter is in scientific notation.
Also, add some tests for empty separator, as that may catch
some corner cases.
In many cases, current_column value is not actually needed, but
computing its value is quite expensive (`ansi_width` isn't very
fast).
Move the computation to a LazyCell, so that we only execute it
when required.
Saves 5% on a basic `ls -lR .git`.
* friendly message install file to directory containing directory with same name
* install: test install file to directory containing directory with same name
Fix a bug in `mv` where it would hang indefinitely while trying to copy
a FIFO across filesystems. The solution is to remove the old FIFO and
create a new one on the new filesystem.
Fixes#7076
Especially after splitting the `parse` function in multiple
chunks, this makes the code a bit easier to read, despite the fact
that `parse` is still inherently a complex function.