From 042e43247f396a9000fead59d9bff87bf12806d6 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 30 Oct 2024 01:51:14 +0100 Subject: 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) --- vendor/librune/lib/builder/u8strfit.c | 11 --------- vendor/librune/lib/builder/u8strfree.c | 9 ------- vendor/librune/lib/builder/u8strgrow.c | 41 ------------------------------- vendor/librune/lib/builder/u8strinit.c | 18 -------------- vendor/librune/lib/builder/u8strpushr.c | 13 ---------- vendor/librune/lib/builder/u8strpushstr.c | 17 ------------- vendor/librune/lib/builder/u8strpushu8.c | 16 ------------ 7 files changed, 125 deletions(-) delete mode 100644 vendor/librune/lib/builder/u8strfit.c delete mode 100644 vendor/librune/lib/builder/u8strfree.c delete mode 100644 vendor/librune/lib/builder/u8strgrow.c delete mode 100644 vendor/librune/lib/builder/u8strinit.c delete mode 100644 vendor/librune/lib/builder/u8strpushr.c delete mode 100644 vendor/librune/lib/builder/u8strpushstr.c delete mode 100644 vendor/librune/lib/builder/u8strpushu8.c (limited to 'vendor/librune/lib/builder') diff --git a/vendor/librune/lib/builder/u8strfit.c b/vendor/librune/lib/builder/u8strfit.c deleted file mode 100644 index d0f0ecb..0000000 --- a/vendor/librune/lib/builder/u8strfit.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -#include "builder.h" - -#include "internal/common.h" - -struct u8str * -u8strfit(struct u8str *b) -{ - return (b->p = realloc(b->p, b->len)) ? b : nullptr; -} diff --git a/vendor/librune/lib/builder/u8strfree.c b/vendor/librune/lib/builder/u8strfree.c deleted file mode 100644 index 506c71b..0000000 --- a/vendor/librune/lib/builder/u8strfree.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -#include "builder.h" - -void -u8strfree(struct u8str b) -{ - free(b.p); -} 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 - -#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; -} diff --git a/vendor/librune/lib/builder/u8strinit.c b/vendor/librune/lib/builder/u8strinit.c deleted file mode 100644 index 29947e8..0000000 --- a/vendor/librune/lib/builder/u8strinit.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#include "builder.h" - -#include "internal/common.h" - -struct u8str * -u8strinit(struct u8str *b, size_t n) -{ - if (n) { - if (!(b->p = malloc(n))) - return nullptr; - } else - b->p = nullptr; - b->len = 0; - b->cap = n; - return b; -} diff --git a/vendor/librune/lib/builder/u8strpushr.c b/vendor/librune/lib/builder/u8strpushr.c deleted file mode 100644 index 60c1d50..0000000 --- a/vendor/librune/lib/builder/u8strpushr.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "builder.h" -#include "utf8.h" - -#include "internal/common.h" - -struct u8str * -u8strpushr(struct u8str *b, rune ch) -{ - if (!u8strgrow(b, b->len + u8wdth(ch))) - return nullptr; - b->len += rtou8(b->p + b->len, ch, b->cap - b->len); - return b; -} diff --git a/vendor/librune/lib/builder/u8strpushstr.c b/vendor/librune/lib/builder/u8strpushstr.c deleted file mode 100644 index a036840..0000000 --- a/vendor/librune/lib/builder/u8strpushstr.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#include "builder.h" -#include "utf8.h" - -#include "internal/common.h" - -struct u8str * -u8strpushstr(struct u8str *b, const char *s) -{ - size_t n = strlen(s); - if (!u8strgrow(b, b->len + n)) - return nullptr; - memcpy(b->p + b->len, s, n); - b->len += n; - return b; -} diff --git a/vendor/librune/lib/builder/u8strpushu8.c b/vendor/librune/lib/builder/u8strpushu8.c deleted file mode 100644 index dc6db11..0000000 --- a/vendor/librune/lib/builder/u8strpushu8.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#include "builder.h" -#include "utf8.h" - -#include "internal/common.h" - -struct u8str * -u8strpushu8(struct u8str *b, struct u8view v) -{ - if (!u8strgrow(b, b->len + v.len)) - return nullptr; - memcpy(b->p + b->len, v.p, v.len); - b->len += v.len; - return b; -} -- cgit v1.2.3