Because translate-c can't handle struct stat as defined by musl.
(Should have done this in the first place, but wasn't aware fstatat()
had been properly wrapped in std.c)
`null` here indicates to Zig that it should decide for itself whether
to enable PIE or not. On some targets (like macOS or OpenBSD), it is
required and so current default will cause unneccessary build error.
Behavior for `-Dpie=false` and `-Dpie=true` is not changed.
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
Seems like it was used here because `pkg-config` does not work with
`zstd` passed but works with `libzstd`.
In 0.14.0 there was a change with allows pkg-config to be used here:
it now tries to use `lib+libname.pc` if `libname.pc` was not found:
https://github.com/ziglang/zig/pull/22069
This change allows Zig to use plain file search if pkg-config was not
found (it would now search `libzstd.so` instead of `liblibzstd.so`).
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
Consolidates some options in one single module now, which is helpful
when you want to edit linked libraries etc.
Useful for making future changes here, or patching by distros (1 place
to change instead of 2).
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
Arguably, my previous use of @setCold() was incorrect in some cases, but
it happened to work out better than not providing any hints. Let's use
the more granular hints now that Zig 0.14 supports them.
See https://github.com/ziglang/zig/pull/21585 .
I went with second option listed in `Conditional Barriers` section.
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
New `@branchHint` builtin is more expressive than `@setCold`, therefore
latter was removed.
See https://github.com/ziglang/zig/pull/21214 .
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
It was deprecated before, and became hard compile error.
See https://github.com/ziglang/zig/pull/19847 .
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
I was trying to remove the need for that strip command with some
-fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables,
but passing even one of those to the ncurses build would result in an
ncdu binary that's twice as large and fails to run. I don't get it.
I had a feeling my last workaround wasn't correct, turns out my basic
assumption about ZSTD_decompressStream() was wrong: rather than
guaranteeing some output when there's enough input, it always guarantees
to consume input when there's space in the output.
Fixed the code and adjusted the buffers again.
Turns out that zstd can consume compressed data without returning any
decompressed data when the input buffer isn't full enough. I just
increased the input buffer as a workaround.
Fixes#245
json/scanner.zig in std notes inconsistencies in the standard as to
whether unpaired surrogate halves are allowed. That implementation
disallows them and so does this commit.
Which is, AFAIK, a recommended practice. Reduces the number of times
translate-c is being run and (most likely) simplifies a possible future
transition if/when @cImport is thrown out of the language.
Also uses zstd.h instead of my own definitions, mainly because I plan to
use the streaming API as well and those need more definitions.
Haven't mentioned the new -O flag in the examples section yet. Let's
first keep it as a slightly lower-profile feature while the format gains
wider testing and adoption.
Kernfs checking was previously done for every directory scanned, but the
new parallel scanning code only performs the check when the dev id is
different from parent, which isn't nearly as common.
(In fact, in typical scenarios this only ever happens once per dev id,
rendering the cache completely useless. But even people will 10k bind
mounts are unlikely to notice a performance impact)
Saves another 70k on the x86_64 binary, more on x86.
None of the included C or Zig code will unwind the stack at any point,
so these sections seem pretty useless.
This prevents displaying invalid zero values or writing such values out
in JSON/bin exports. Very old issue, actually, but with the new binfmt
experiments it's finally started annoying me.
I realized that the 16 MiB limitation implied that the index block could
only hold ((2^24)-16)/8 =~ 2 mil data block pointers. At the default
64k data block size that means an export can only reference up to
~128 GiB of uncompressed data. That's pretty limiting.
This change increases the maximum size of the index block to 256 MiB,
supporting ~33 mil data block pointers and ~2 TiB of uncompressed data
with the default data block size.
I find it hard to imagine that this will happen on a real filesystem,
but it can be triggered by a malicious export file. Better protect
against that than invoke undefined behavior.