diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2025-04-29 04:49:36 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2025-04-29 19:31:22 +0300 |
commit | e66de4a1d332db26f00a6a4cec01284bc042a762 (patch) | |
tree | 76f5ca80a83a7eda767e1f6eb717c68722906e5c /c_implementation | |
parent | f540fc7b2532b756426bb39beee55e8a8ab8de0f (diff) | |
download | arching-kaos-tools-e66de4a1d332db26f00a6a4cec01284bc042a762.tar.gz arching-kaos-tools-e66de4a1d332db26f00a6a4cec01284bc042a762.tar.bz2 arching-kaos-tools-e66de4a1d332db26f00a6a4cec01284bc042a762.zip |
[suggestion] memcpy instead of loop using
Diffstat (limited to 'c_implementation')
-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); |