diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2025-04-29 04:49:36 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2025-04-29 04:49:36 +0300 |
commit | eb4bc26c46c682e78a695ed126ea7dced69f0a52 (patch) | |
tree | 5c6ce3b9eafa8106fd14d3e7588e155c4c510667 | |
parent | 4412f7ec16743b7d0ee8fc176c101b0124b71a30 (diff) | |
download | arching-kaos-tools-origin/libakfs-cat-from-map-v3-hash.tar.gz arching-kaos-tools-origin/libakfs-cat-from-map-v3-hash.tar.bz2 arching-kaos-tools-origin/libakfs-cat-from-map-v3-hash.zip |
[suggestion] memcpy instead of loop usingorigin/libakfs-cat-from-map-v3-hash
-rw-r--r-- | c_implementation/src/ak_fs.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/c_implementation/src/ak_fs.c b/c_implementation/src/ak_fs.c index a5eee10..a75559c 100644 --- a/c_implementation/src/ak_fs.c +++ b/c_implementation/src/ak_fs.c @@ -327,15 +327,9 @@ int ak_fs_cat_file_from_root_hash(sha512sum* rh) ak_fs_sha512sum_init(&h0.head); ak_fs_sha512sum_init(&h0.tail); h0.root = *rh; - for( size_t i = 0; i < 128; ++i ) - { - h1[i] = buffer[i]; - } + memcpy(h1, buffer, 128); h1[128] = '\0'; - for( size_t i = 0; i < 128; ++i ) - { - h2[i] = buffer[i+129]; - } + memcpy(h2, buffer + 129, 128); h2[128] = '\0'; ak_fs_sha512sum_string_to_struct(h1, &h0.head); ak_fs_sha512sum_string_to_struct(h2, &h0.tail); |