aboutsummaryrefslogtreecommitdiff
path: root/util.h
AgeCommit message (Collapse)AuthorFilesLines
2025-12-22move all standard library includes into util.hRandy Palamar1-0/+36
2025-12-16make vis a single file buildRandy Palamar1-1/+22
2025-12-16mark all functions in headers with VIS_EXPORT or VIS_INTERNALRandy Palamar1-1/+6
if vis actually wants to be a library exported symbols may need mark up depending on the platform (eg. __declspec(dllexport)). This needs to be hidden behind a macro because the way you export is not the same on every platform. I did this based on the assumption that vis.h was supposed to be the only interface to the "vis" library. Since nobody actually uses vis as a library I have no idea if this is actually correct. Anyway marking up all prototypes like this allows for one to convert all functions to static if a single translation unit is used by inserting at the start: #define VIS_INTERNAL static #define VIS_EXPORT static
2025-12-08util: replace memrchr with internal versionRandy Palamar1-11/+0
The amount of code we need to detect if this is present and handle the fallback is more than if we just provide it ourselves. Also we are passing in a difference of pointers so the argument type should be ptrdiff_t. This avoids a C brain damage of having unsigned size type which can wrap around if the caller is careful.
2017-05-11Move the #defines within the #include guardsParide Legovini1-5/+4
2017-05-11Fix compilation on GNU Hurd systemsParide Legovini1-0/+11
On GNU Hurd systems PIPE_BUF and PATH_MAX are not defined, and the compilation fails. This patch defines them if they aren't.
2017-04-09text: add mem{r,}chr(3) based byte search functionsMarc André Tanner1-0/+11
These are generally implemented efficiently in libc. While memrchr(3) is non-standard, it is a common extension. If it is not available, we use a simple C implementation from musl.
2017-02-20util: add overflow safe unsigned addition functionMarc André Tanner1-0/+14
2014-09-10Add comments where appropriateMarc André Tanner1-2/+2
2014-09-09Rename vis.[ch] to editor.[ch] and main.c to vis.cMarc André Tanner1-0/+5
2014-08-23Share common macros in util.hMarc André Tanner1-0/+7