nnn source code already uses C11, which introduced `_Alignas` [^0] as a
standardized alternative to __attribute__((aligned)).
there are no other usage of `__attribute__` in the nnn source code, so
in theory this should make things more portable across compilers.
also removes an unnecessary usage of `alloca()` with an aligned constant
sized buffer instead.
[^0]: https://en.cppreference.com/w/c/language/_Alignas
Found memory deallocation edge case
Update and move chunk limit check
Generalize maximum size of input
Remove hard-coded values
Remove superfluous check before free
Let the kernel deal with extra data
Handle signals while reading
Conform to the manpage
Make CI happy
use `size_t` instead of `ssize_t`
`ssize_t` was used just so `--i` when `i` was zero would become -1
instead of SIZE_MAX. for looping through something in reverse order, the
"goes-to" operator (`-->`) can be used instead which doesn't require `i`
to be signed anymore.
remove useless blank line
use a normal loop
don't see any reason why freeing in reverse order would've been needed.
Co-authored-by: N-R-K <nrk@disroot.org>
- support listing maximum 16K files
- check if target directory exists before directory tree creation
in most of the cases many files will be under the same directory
- make frequently used function 'inline'
a lot of the extension use the same icon. this can be exploited via
having an array with all the unique icons and then storing a single byte
index into the unique array.
when using `O_EMOJI` this results in around ~1.7KiB drop in the total
table size. `O_NERD` and `O_ICONS` get roughly ~0.5KiB savings.
This pretty much reworks the entire icon system. Some notable changes:
* The extensions are put into a statically generated hash-table instead
of a sorted array. We use Robin-Hood insertion to reduce the max probe
length. Currently we need to probe only 2 slots for `O_EMOJI` and only
3 for `O_NERD`/`O_ICONS`.
* I've opted not to use a perfect-hash since the perfect hashes
generated by [`gperf`](https://www.gnu.org/software/gperf) used some
huge lookup table. The hash function also wasn't as minimal as I'd
like.
* Colors are now using X-Macros. This should speed up startup since we
don't have to search `icons_ext` linearly to find unique colors.
* The hash-table generator outputs a more space optimized `struct
icon_pair` using a char array instead of char pointer. This brings
down the binary size from `145KiB` when using `O_NERD` down to
`137KiB`.
* Some unnecessary duplication and indirection has been reduced by using
the `ICON_STR()` macro.
reduces some unncessary code. and when initializing larger objects,
compilers (gcc and clang at least) typically tend to compile it down to
a memset anyways.
anything not explicitly initialized will be implicitly initialized to
zero. this makes things more robust since comments are not checked by
the compiler and can be incorrect.
Reasons:
1. `b` is not a special key and will be interpreted as a filter
2. with this change pressing the standard `-` inside a symlinked
bookmark takes back to the bookmarks directory. This deviates
from the regular bookmarks behaviour.
have been using the %j substitution for a bit now, it's quite nice :)
but it's also quite annoying when doing something like
mv "%j" ./
in this case, the files have been moved but the selection is incorrectly
points to them.
when there's a successful operation made on the selection via the native
prompt, it makes sense to clear the selection.
The check is done when traversing directories in preorder i.e before the files
inside are enumerated. Postorder traversal is unwinding, so mostly we are done
with the calculation and finishing off the thread.