summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2025-08-01Add function effect attributes and warning suppression macrosDavid Robillard12-104/+121
2025-08-01Avoid static const local variables and use constexpr where possibleDavid Robillard7-27/+51
We need to avoid static local variables because clang (annoyingly) can't infer nonblocking for functions with them, even if they're trivial types. So, switch to using constexpr if building as C23, otherwise, just use const (this is trivial for the optimizer to figure out anyway).
2025-08-01Record complexity explicitly in clang-tidy configurationDavid Robillard1-2/+4
This documents the complexity of the different areas of code in a machine-checked way that highlights where the most complexity lies, and will trigger a warning if it creeps further. Unfortunately, a few massive outliers here obscure the much lower average complexity.
2025-08-01Add missing pure function attributeDavid Robillard1-1/+1
2025-07-25Fix crash when attempting to remove from an empty BTreeDavid Robillard1-0/+4
2025-06-30Strengthen Windows warning flagsDavid Robillard1-6/+6
2025-06-30Strengthen file copying and comparison functionsDavid Robillard6-49/+124
2025-06-30Avoid "deprecated" POSIX functions on WindowsDavid Robillard7-40/+93
May I never screw anything up as badly as Microsoft screwed up this whole C "security" thing.
2025-06-29Test failed allocation in zix_create_directories()David Robillard1-25/+25
2025-06-29Gracefully handle failed allocation in path functionsDavid Robillard1-1/+7
2025-06-29Improve test coverageDavid Robillard3-18/+23
2025-06-29Simplify conditionalsDavid Robillard2-11/+16
2025-06-29Fix handling of errors when closing filesDavid Robillard2-8/+6
The old logic here was backwards, but wasn't caught by the tests since hitting this situation requires filesystem failures that are hard to mock. The preliminary errno check also isn't necessary, dealing with any previous error condition is the responsibility of the caller.
2025-06-25Suppress new warnings in clang and clang-tidy 20David Robillard1-0/+2
2025-06-07Fix word size calculation in BTree implementationDavid Robillard1-4/+5
2025-06-07Add missing const qualifiersDavid Robillard1-3/+3
2025-06-07Reduce empty BTree memory requirementsDavid Robillard1-22/+27
Avoid over-allocating the ZixBTree structure, and only allocate a root node when elements are inserted. The over-allocation was to make all allocations use pages (towards disk-backed storage), but since this isn't actually supported at the moment it was just a waste of memory.
2025-06-07Fix potential memory leak on failed allocation in POSIX environmentDavid Robillard1-0/+1
Adds a test for a new potentially failing allocation added in 8348512a60399d172fc83cd7bdf121d4c0b1015e "Use getenv() instead of environ to avoid issues on FreeBSD", and fixes the memory leak it exposes. Avoiding this temporary allocation (which is only for adding null termination) is the main reason getenv() was initially avoided.
2025-06-07Fix typo in commentDavid Robillard1-1/+1
2025-02-10Use getenv() instead of environ to avoid issues on FreeBSDDavid Robillard1-31/+30
2025-02-10Fully parenthesize expressionsDavid Robillard2-2/+2
2024-12-11Add assertion to ensure integer overflow is avoidedDavid Robillard1-0/+1
2024-12-11Avoid _get_osfhandle with clang on WindowsDavid Robillard1-0/+12
This function crashes when called in a clang build, I'm not sure why. File locking in general isn't a realiable enough facility, and this API weirdly uses FILE* unlike anything else, adding it was probably a mistake.
2024-12-11Fix clang and clang-tidy warnings on WindowsDavid Robillard4-3/+10
2024-12-11Remove old tree_debug.h headerDavid Robillard2-167/+6
2024-12-11Fix potential null dereferencesDavid Robillard2-2/+4
2024-12-11Fix memory leakDavid Robillard1-5/+4
Also removes the last MAX_PATH buffer limit.
2024-12-11Handle emscripten and MinGW stubs the same wayDavid Robillard2-3/+3
2024-12-11Add ZixDirEntryVisitFuncDavid Robillard2-10/+6
Although this type is only used once in the API, define it to avoid the complicated syntax of inline function pointer parameters, which confuses both people and clang-format.
2024-12-11Support building for UWPDavid Robillard2-21/+75
2024-12-11Support building for Windows with or without UNICODEDavid Robillard4-41/+267
2024-12-11Add option to build for older Windows versionsDavid Robillard3-22/+81
Adds configuration checks for Windows API functions, and a win_ver configuration option to change the targeted API version.
2024-12-11Clean up platform C flagsDavid Robillard1-1/+0
Remove platform flags from executable (test program) builds, since they shouldn't be needed there (that being the whole point of a portability library), and replace POSIX flags in WIndows with WIN32_LEAN_AND_MEAN.
2024-12-11Use DeleteFile() instead of remove()David Robillard1-4/+3
2024-12-11Use CreateDirectory() instead of _mkdir()David Robillard1-4/+3
2024-12-11Fix widening conversions after arithmeticDavid Robillard4-11/+11
2024-11-24Clean up includesDavid Robillard2-3/+3
2024-11-24Add zix_expand_environment_strings()David Robillard2-0/+156
2024-11-23Use angle brackets for library includesDavid Robillard23-46/+58
2024-11-15Update clang-format configurationDavid Robillard7-44/+22
2024-07-18Add missing includeDavid Robillard1-0/+1
2024-07-18Suppress new warnings in clang and clang-tidy 18David Robillard1-0/+1
2024-07-15Add missing pure function attributesDavid Robillard1-0/+2
2024-06-26Add zix_string_view_equals()David Robillard1-1/+20
2024-06-23Fix build on POSIX systems without PATH_MAX definedDavid Robillard1-3/+5
2024-06-22Avoid cppcheck warning about self-assignmentDavid Robillard1-4/+5
2024-06-22Remove redundant conditionalsDavid Robillard2-4/+5
2024-06-22Add missing const qualifierDavid Robillard1-1/+1
2024-06-04Add missing includeDavid Robillard1-0/+1
2023-11-17Avoid fdatasync() on DarwinDavid Robillard1-1/+7
This isn't present at all on (older?) literal Darwin, and additionally fsync() there doesn't actually flush writes to storage like it does on Linux. So, use F_FULLFSYNC which was invented as an alternative API to do this.