From 8499353982cefb51a5680141048fe3c7018376ed Mon Sep 17 00:00:00 2001 From: Graham Keeling Date: Wed, 22 Jun 2022 08:42:46 +1000 Subject: [PATCH] Delete more unused code (from hexmap.c). Change-Id: I44357245484605d05fe73cfc880db2ef1dd7ba35 --- src/hexmap.c | 107 ------------------- src/hexmap.h | 11 -- src/prog.c | 1 - utest/client/test_backup_phase2.c | 1 - utest/server/monitor/test_cache.c | 1 - utest/server/test_backup_phase2.c | 2 - utest/server/test_dpth.c | 1 - utest/server/test_manio.c | 2 - utest/server/test_restore.c | 1 - utest/server/test_resume.c | 3 - utest/test_hexmap.c | 164 +----------------------------- 11 files changed, 5 insertions(+), 289 deletions(-) diff --git a/src/hexmap.c b/src/hexmap.c index 8fc798f1a..043b64c22 100644 --- a/src/hexmap.c +++ b/src/hexmap.c @@ -1,65 +1,6 @@ #include "burp.h" #include "hexmap.h" -// FIX THIS: Should be set in configure somewhere. -#include - -#define HEXMAP_SIZE 256 - -static uint8_t hexmap1[HEXMAP_SIZE]; -static uint8_t hexmap2[HEXMAP_SIZE]; - -uint8_t md5sum_of_empty_string[MD5_DIGEST_LENGTH]; - -static void do_hexmap_init(uint8_t *hexmap, uint8_t shift) -{ - uint8_t i; - uint8_t h; - memset(hexmap, 0, HEXMAP_SIZE); - for(i='0', h=0x00; i<='9'; i++, h++) hexmap[i]=h<asfd_add(as, asfd); @@ -349,7 +348,6 @@ static void run_test_changed(int expected_ret, struct slist *slist=NULL; prng_init(0); base64_init(); - hexmap_init(); setup(&as, &sdirs, &confs); asfd=asfd_mock_setup(&reads, &writes); as->asfd_add(as, asfd); diff --git a/utest/server/test_dpth.c b/utest/server/test_dpth.c index d60e58770..6e7f6beb1 100644 --- a/utest/server/test_dpth.c +++ b/utest/server/test_dpth.c @@ -26,7 +26,6 @@ static void assert_components(struct dpth *dpth, static struct dpth *setup(void) { struct dpth *dpth; - hexmap_init(); fail_unless(recursive_delete(basepath)==0); fail_unless((dpth=dpth_alloc())!=NULL); assert_components(dpth, 0, 0, 0); diff --git a/utest/server/test_manio.c b/utest/server/test_manio.c index cb217e422..f31cf1584 100644 --- a/utest/server/test_manio.c +++ b/utest/server/test_manio.c @@ -80,7 +80,6 @@ static void test_manifest(int phase) int entries=1000; prng_init(0); base64_init(); - hexmap_init(); recursive_delete(path); slist=build_manifest(path, entries, phase); @@ -124,7 +123,6 @@ static void test_manifest_tell_seek(int phase) int entries=1000; prng_init(0); base64_init(); - hexmap_init(); recursive_delete(path); slist=build_manifest(path, entries, phase); diff --git a/utest/server/test_restore.c b/utest/server/test_restore.c index 29c757916..74270648c 100644 --- a/utest/server/test_restore.c +++ b/utest/server/test_restore.c @@ -137,7 +137,6 @@ static void run_test(int expected_ret, char *dir_for_notify=NULL; prng_init(0); base64_init(); - hexmap_init(); setup(&as, &sdirs, &confs); set_string(confs[OPT_BACKUP], "1"); asfd=asfd_mock_setup(&reads, &writes); diff --git a/utest/server/test_resume.c b/utest/server/test_resume.c index 5ad913a16..c0f1b6866 100644 --- a/utest/server/test_resume.c +++ b/utest/server/test_resume.c @@ -216,7 +216,6 @@ static void last_good_entry(void setup_slist(struct slist *, int *)) prng_init(0); base64_init(); - hexmap_init(); fail_unless(!recursive_delete(path)); fail_unless((slist=slist_alloc())!=NULL); @@ -430,7 +429,6 @@ static void go_past_entry(void setup_slist(struct slist *, int *)) prng_init(0); base64_init(); - hexmap_init(); fail_unless(!recursive_delete(path)); fail_unless((slist=slist_alloc())!=NULL); @@ -616,7 +614,6 @@ static void go_before_entry( prng_init(0); base64_init(); - hexmap_init(); fail_unless(!recursive_delete(path)); fail_unless((slist=slist_alloc())!=NULL); diff --git a/utest/test_hexmap.c b/utest/test_hexmap.c index 5048aa049..b0ac14de5 100644 --- a/utest/test_hexmap.c +++ b/utest/test_hexmap.c @@ -7,57 +7,29 @@ #include "../src/alloc.h" #include "../src/hexmap.h" -START_TEST(test_md5sum_of_empty_string) -{ - MD5_CTX *md5=NULL; - uint8_t checksum[MD5_DIGEST_LENGTH]; - - md5=(MD5_CTX *)calloc_w(1, sizeof(MD5_CTX), __func__); - fail_unless(md5!=NULL); - MD5_Init(md5); - MD5_Final(checksum, md5); - hexmap_init(); - fail_unless(!memcmp(md5sum_of_empty_string, md5, MD5_DIGEST_LENGTH)); - free_v((void **)&md5); -} -END_TEST - struct md5data { - const char *str; + const char *str; uint8_t bytes[MD5_DIGEST_LENGTH]; }; static struct md5data m[] = { { "d41d8cd98f00b204e9800998ecf8427e", { 0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04, - 0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E } }, + 0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E } }, { "00000000000000000000000000000000", { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, { "ffffffffffffffffffffffffffffffff", { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }, { "0123456789abcdef0123456789abcdef", { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, - 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF } }, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF } }, }; -START_TEST(test_md5str_to_bytes) -{ - hexmap_init(); - FOREACH(m) - { - uint8_t bytes[MD5_DIGEST_LENGTH]; - md5str_to_bytes(m[i].str, bytes); - fail_unless(!memcmp(bytes, m[i].bytes, MD5_DIGEST_LENGTH)); - } -} -END_TEST - START_TEST(test_bytes_to_md5str) { - hexmap_init(); FOREACH(m) { const char *str; @@ -67,125 +39,6 @@ START_TEST(test_bytes_to_md5str) } END_TEST -struct savepathdata -{ - const char *str; - uint64_t bytes; -}; - -static struct savepathdata ssavepath[] = { - { "0011/2233/4455", 0x0011223344550000 }, - { "0000/0000/0000", 0x0000000000000000 }, - { "0000/0000/0001", 0x0000000000010000 }, - { "FFFF/FFFF/FFFF", 0xFFFFFFFFFFFF0000 } -}; -static struct savepathdata ssavepathsig[] = { - { "0000/0000/0000/0000", 0x0000000000000000 }, - { "0000/0000/0000/0001", 0x0000000000000001 }, - { "0011/2233/4455/6789", 0x0011223344556789 }, - { "AA00/BB11/CC22/DD33", 0xAA00BB11CC22DD33 }, - { "FFFF/FFFF/FFFF/FFFF", 0xFFFFFFFFFFFFFFFF } -}; - -static void do_savepath_str_to_uint64(struct savepathdata *d, size_t s) -{ - size_t i; - uint64_t bytes; - for(i=0; i