diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index d747192..e9e06ba 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -5,10 +5,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ZedThree/clang-tidy-review@v0.14.0 + - uses: ZedThree/clang-tidy-review@v0.20.0 id: review with: config_file: '.clang-tidy' - cmake_command: cmake . -D CMAKE_C_COMPILER=clang-16 + cmake_command: cmake . -D CMAKE_C_COMPILER=clang-18 - if: steps.review.outputs.total_comments > 0 run: exit 1 diff --git a/.idea/misc.xml b/.idea/misc.xml index d2e15db..5ebbd37 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,9 +1,5 @@ - - diff --git a/src/main.c b/src/main.c index aca2de2..d77cc78 100644 --- a/src/main.c +++ b/src/main.c @@ -15,7 +15,7 @@ void AddNode(Head** head, long data) { } node->data = data; - node->next_node = NULL; + node->next_node = nullptr; if ((*head) == NULL) { (*head) = malloc(sizeof(Head)); @@ -70,7 +70,7 @@ bool RemoveNode(Head** head, long data) { if (current_node == previous_node && current_node->next_node == NULL) { free(current_node); free((*head)); - (*head) = NULL; + (*head) = nullptr; return true; } @@ -139,11 +139,11 @@ void PrintList(Head** head) { while (current_node != NULL) { if (current_node->next_node == NULL) { - wprintf(L"%lc %d %lc %p %lc %lc NULL", kVerticalLine, current_node->data, + wprintf(L"%lc %ld %lc %p %lc %lc NULL", kVerticalLine, current_node->data, kVerticalLineDashed, current_node->next_node, kVerticalLine, kArrow); } else { - wprintf(L"%lc %d %lc %p %lc %lc ", kVerticalLine, current_node->data, + wprintf(L"%lc %ld %lc %p %lc %lc ", kVerticalLine, current_node->data, kVerticalLineDashed, current_node->next_node, kVerticalLine, kArrow); } @@ -184,10 +184,10 @@ bool IsScanfInputValid(int input) { void PrintOperationFailedMessage() { printf("Operation failed.\n"); } int main() { - locale_t locale = newlocale(LC_CTYPE, "en_US", NULL); + locale_t locale = newlocale(LC_CTYPE, "en_US", nullptr); uselocale(locale); - Head* head = NULL; + Head* head = nullptr; char* option_id_input = malloc(sizeof(char)); long option_id = -1; char* input_one_string = malloc(sizeof(char)); @@ -197,7 +197,7 @@ int main() { while (option_id != kQuit) { int number_of_assigned_input_items = 0; - char* end = NULL; + char* end = nullptr; long input_one_long = 0; long input_two_long = 0; bool success = false; diff --git a/src/main.h b/src/main.h index dd2d4fb..a49efda 100644 --- a/src/main.h +++ b/src/main.h @@ -1,9 +1,12 @@ +#ifndef MAIN_H +#define MAIN_H + #include -const wchar_t kVerticalLine = 0x2503; -const wchar_t kVerticalLineDashed = 0x2506; -const wchar_t kArrow = 0x2B95; -const int kBase = 10; +constexpr wchar_t kVerticalLine = 0x2503; +constexpr wchar_t kVerticalLineDashed = 0x2506; +constexpr wchar_t kArrow = 0x2B95; +constexpr int kBase = 10; enum Commands { kAdd = 1, kRemove, kInsert, kPrint, kQuit }; @@ -22,3 +25,5 @@ struct Node { long data; Node* next_node; }; + +#endif // MAIN_H