diff options
| author | Thomas Voss <mail@thomasvoss.com> | 2024-10-30 01:51:14 +0100 | 
|---|---|---|
| committer | Thomas Voss <mail@thomasvoss.com> | 2024-10-30 01:51:14 +0100 | 
| commit | 042e43247f396a9000fead59d9bff87bf12806d6 (patch) | |
| tree | e902784464cbe9ce3c5114d513b016523e7e4b29 /vendor/librune/lib/builder/u8strgrow.c | |
| parent | 170b8a92434233241c990c3e9432786de3262bcd (diff) | |
Completely revamp the grab source code
Some of the (many) few changes are:
- Multithreading for significantly faster performance
- The -p/--predicate flag
- Byte offsets as the default
- No customizable colors (maybe this will come back later)
- Newer edition of mlib (formerly librune)
Diffstat (limited to 'vendor/librune/lib/builder/u8strgrow.c')
| -rw-r--r-- | vendor/librune/lib/builder/u8strgrow.c | 41 | 
1 files changed, 0 insertions, 41 deletions
| diff --git a/vendor/librune/lib/builder/u8strgrow.c b/vendor/librune/lib/builder/u8strgrow.c deleted file mode 100644 index 022b216..0000000 --- a/vendor/librune/lib/builder/u8strgrow.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <stdlib.h> - -#include "builder.h" - -#include "internal/common.h" - -static size_t nextpow2(size_t); - -struct u8str * -u8strgrow(struct u8str *b, size_t n) -{ -	if (n > b->cap) { -		b->cap = nextpow2(n); -		if (!(b->p = realloc(b->p, b->cap))) -			return nullptr; -	} -	return b; -} - -size_t -nextpow2(size_t x) -{ -#if defined(__has_builtin) && __has_builtin(__builtin_clzl) -	x = x <= 1 ? 1 : 1 << (64 - __builtin_clzl(x - 1)); -#else -	if (x) { -		x--; -		x |= x >> 1; -		x |= x >> 2; -		x |= x >> 4; -		x |= x >> 8; -		if (sizeof(size_t) >= 4) -			x |= x >> 16; -		if (sizeof(size_t) >= 8) -			x |= x >> 32; -	} -	x++; -#endif - -	return x; -} |