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 bdffc7a commit 02f7845
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DoozyX/[email protected]
- uses: DoozyX/[email protected]
if: false
with:
clangFormatVersion: 16
clangFormatVersion: 18
5 changes: 3 additions & 2 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ZedThree/[email protected]
- uses: ZedThree/[email protected]
if: false
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.

19 changes: 12 additions & 7 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#include "main.h"

#ifdef __APPLE__
#include <_xlocale.h>
#endif
#ifdef __linux__
#include <bits/types/locale_t.h>
#endif
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -15,7 +20,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 +75,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 +144,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 +189,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 +202,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
15 changes: 11 additions & 4 deletions src/main.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#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;
// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables, readability-identifier-naming)
constexpr wchar_t kVerticalLine = 0x2503;
constexpr wchar_t kVerticalLineDashed = 0x2506;
constexpr wchar_t kArrow = 0x2B95;
constexpr int kBase = 10;
// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables, readability-identifier-naming)

enum Commands { kAdd = 1, kRemove, kInsert, kPrint, kQuit };

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

#endif // MAIN_H

0 comments on commit 02f7845

Please sign in to comment.