diff --git a/src/cgi.cpp b/src/cgi.cpp index 5928dcc..a31c86a 100644 --- a/src/cgi.cpp +++ b/src/cgi.cpp @@ -20,7 +20,6 @@ #include -#include #include #include #include @@ -32,8 +31,6 @@ namespace FediBlock::cgi { -using std::cerr; -using std::exception; using std::getline; using std::ios; using std::ofstream; diff --git a/src/files.cpp b/src/files.cpp index 3dd2872..5e734a8 100644 --- a/src/files.cpp +++ b/src/files.cpp @@ -65,7 +65,7 @@ fs::path get_datadir() char *env{getenv("XDG_DATA_HOME")}; if (env != nullptr) { - const auto path{fs::path(env) / "fediblock-backend"}; + auto path{fs::path(env) / "fediblock-backend"}; fs::create_directories(path); return path; } diff --git a/src/git.cpp b/src/git.cpp index 53614bf..7a00711 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -84,7 +84,7 @@ void create_branch() const string branch_name{get_branch_name()}; const string ref_name{"refs/heads/" + branch_name}; git_oid oid_parent; - git_commit *commit; + git_commit *commit{nullptr}; // Get SHA1 of HEAD. check(git_reference_name_to_id(&oid_parent, _repo, "HEAD")); @@ -92,7 +92,7 @@ void create_branch() // Translate SHA-1 to git_commit. check(git_commit_lookup(&commit, _repo, &oid_parent)); - git_reference *branch; + git_reference *branch{nullptr}; // Create new branch. check(git_branch_create(&branch, _repo, branch_name.c_str(), commit, 0)); @@ -127,11 +127,11 @@ void commit(const entry_type &entry) check(git_index_write(index)); // Create commit. - git_signature *sig; + git_signature *sig{nullptr}; git_oid oid_commit; git_oid oid_tree; git_oid oid_parent; - git_tree *tree; + git_tree *tree{nullptr}; git_object *parent{nullptr}; git_reference *ref{nullptr}; diff --git a/src/gitea.cpp b/src/gitea.cpp index 6cccc81..9b459e4 100644 --- a/src/gitea.cpp +++ b/src/gitea.cpp @@ -91,7 +91,7 @@ size_t writer_body(char *data, size_t size, size_t nmemb) string api_request(const http_method method, const string_view path, const string_view body) { - CURLcode code; + CURLcode code{}; string url{string(_forge_baseurl) += path}; _curl_buffer_body.clear(); @@ -132,7 +132,7 @@ string api_request(const http_method method, const string_view path, throw runtime_error{"libcurl error: " + to_string(code)}; } - long http_status; // NOLINT(google-runtime-int) + long http_status{0}; // NOLINT(google-runtime-int) // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) curl_easy_getinfo(_connection, CURLINFO_RESPONSE_CODE, &http_status); if (http_status < 200 || http_status >= 300) diff --git a/src/main.cpp b/src/main.cpp index f8bfe0c..d10cce4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,12 +26,10 @@ #include #include -#include using std::cerr; using std::cout; using std::exception; -using std::to_string; using namespace FediBlock;