Skip to content

Commit

Permalink
Add minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
audio-engineer committed Nov 16, 2024
1 parent d014e08 commit 1314a4f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 0 additions & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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));
Expand All @@ -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;
Expand Down
13 changes: 9 additions & 4 deletions src/main.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#ifndef MAIN_H
#define MAIN_H

#include <wchar.h>

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 };

Expand All @@ -22,3 +25,5 @@ struct Node {
long data;
Node* next_node;
};

#endif // MAIN_H

0 comments on commit 1314a4f

Please sign in to comment.