summaryrefslogtreecommitdiff
path: root/src/blob.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-09-30 14:11:37 +0300
committerTimo Teräs <timo.teras@iki.fi>2020-10-09 16:09:19 +0300
commitefe0c4afecb9fd3da2ab4849d2b8edd5bea14d08 (patch)
treeb04a9d2533148a1fcb4a28560ffd76c4bbc5e5ad /src/blob.c
parent81782bfc150225df75b11efa4fa0ade428ae3676 (diff)
downloadapk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.gz
apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.bz2
apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.xz
apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.zip
adb: introduce apk-tools database format, and few applets
This is a flat buffers inspired format that allows fast mmaped access to the data with low overhead, signature support and relatively good forward support.
Diffstat (limited to 'src/blob.c')
-rw-r--r--src/blob.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/blob.c b/src/blob.c
index 1a63686..3a20439 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -256,6 +256,13 @@ int apk_blob_compare(apk_blob_t a, apk_blob_t b)
return 1;
}
+int apk_blob_sort(apk_blob_t a, apk_blob_t b)
+{
+ int s = memcmp(a.ptr, b.ptr, min(a.len, b.len));
+ if (s != 0) return s;
+ return a.len - b.len;
+}
+
int apk_blob_ends_with(apk_blob_t a, apk_blob_t b)
{
if (a.len < b.len) return 0;