Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: drop simdjson dependency #23

Merged
merged 1 commit into from
Oct 23, 2023
Merged

refactor: drop simdjson dependency #23

merged 1 commit into from
Oct 23, 2023

Conversation

Tachi107
Copy link
Owner

cloudflare-ddns now doesn't depend anymore on simdjson, and JSON "parsing" is done manually with a really simple function which just looks at a JSON string and extracts a string value given a key, which is sufficient for cloudflare-ddns' needs.

Dropping the simdjson dependency makes the project way easier and faster to compile, likely less resource intensive since no fancy SIMD instructions are executed, and more portable.

@@ -261,8 +260,8 @@
return DDNS_ERROR_GENERIC;
}

std::memcpy(zone_id, zone_id_sv.data(), zone_id_sv.length());
zone_id[zone_id_sv.length()] = '\0';
std::memcpy(zone_id, zone_id_sv->data(), zone_id_sv->length());

Check notice

Code scanning / Flawfinder (reported by Codacy)

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Note

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.

std::memcpy(record_id, record_id_sv.data(), record_id_sv.length());
record_id[record_id_sv.length()] = '\0';
std::memcpy(record_id, record_id_sv->data(), record_id_sv->length());

Check notice

Code scanning / Flawfinder (reported by Codacy)

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Note

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
return DDNS_ERROR_USAGE;
}

std::memcpy(record_ip, record_ip_sv.data(), record_ip_sv.length());
record_ip[record_ip_sv.length()] = '\0';
std::memcpy(record_ip, record_ip_sv->data(), record_ip_sv->length());

Check notice

Code scanning / Flawfinder (reported by Codacy)

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Note

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
return DDNS_ERROR_USAGE;
}

std::memcpy(record_ip, record_ip_sv.data(), record_ip_sv.length());
record_ip[record_ip_sv.length()] = '\0';
std::memcpy(record_ip, record_ip_sv->data(), record_ip_sv->length());

Check notice

Code scanning / Flawfinder (reported by Codacy)

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Note

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
@@ -23,10 +23,9 @@
#endif

#include <cstring> /* std::memcpy, std::size_t, std::strlen */
#include <optional> /* std::optional */

Check warning

Code scanning / Cppcheck (reported by Codacy)

Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. Warning

Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
@@ -18,21 +18,14 @@
#include <cstring> /* std::memchr, std::memcpy */
#include <filesystem> /* std::filesystem::path::preferred_separator */
#include <fstream> /* std::ifstream, std::ofstream */
#include <optional> /* std::optional */

Check warning

Code scanning / Cppcheck (reported by Codacy)

Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. Warning

Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
@@ -31,7 +31,7 @@

## Build

libcloudflare-ddns relies on [libcurl](https://curl.se) and [simdjson](https://simdjson.org), while the executable also depends on [inih](https://github.com/benhoyt/inih).
libcloudflare-ddns relies on [libcurl](https://curl.se) only, while the executable also depends on [inih](https://github.com/benhoyt/inih).

Check warning

Code scanning / Markdownlint (reported by Codacy)

Expected: 80; Actual: 139 Warning

Expected: 80; Actual: 139
cloudflare-ddns now doesn't depend anymore on simdjson, and JSON
"parsing" is done manually with a really simple function which just
looks at a JSON string and extracts a string value given a key, which is
sufficient for cloudflare-ddns' needs.

Dropping the simdjson dependency makes the project way easier and faster
to compile, likely less resource intensive since no fancy SIMD
instructions are executed, and more portable.
@Tachi107 Tachi107 closed this in fce9595 Oct 23, 2023
@Tachi107 Tachi107 merged commit fce9595 into main Oct 23, 2023
30 of 40 checks passed
@Tachi107 Tachi107 deleted the no-simdjson branch October 23, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant