Skip to content

Commit

Permalink
Update ClangFormat and IDE configuration, reformat code according to …
Browse files Browse the repository at this point in the history
…new ClangFormat configuration
  • Loading branch information
audio-engineer committed Nov 14, 2023
1 parent 1acffc4 commit 4f8141e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
BasedOnStyle: Google
DerivePointerAlignment: false
PointerAlignment: Left
2 changes: 2 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

34 changes: 17 additions & 17 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <wchar.h>
#include <xlocale.h>

void AddNode(Head **head, long data) {
Node *node = malloc(sizeof(Node));
void AddNode(Head** head, long data) {
Node* node = malloc(sizeof(Node));

if (node == NULL) {
return;
Expand All @@ -31,7 +31,7 @@ void AddNode(Head **head, long data) {
return;
}

Node *current_node = (*head)->first_node;
Node* current_node = (*head)->first_node;

while (current_node->next_node != NULL) {
current_node = current_node->next_node;
Expand All @@ -40,15 +40,15 @@ void AddNode(Head **head, long data) {
current_node->next_node = node;
}

bool RemoveNode(Head **head, long data) {
bool RemoveNode(Head** head, long data) {
if ((*head) == NULL) {
printf("Operation failed. List is empty.\n");

return false;
}

Node *current_node = (*head)->first_node;
Node *previous_node = current_node;
Node* current_node = (*head)->first_node;
Node* previous_node = current_node;

while (current_node->next_node != NULL) {
if (current_node->data != data) {
Expand Down Expand Up @@ -90,15 +90,15 @@ bool RemoveNode(Head **head, long data) {
return true;
}

bool InsertNode(Head **head, NodeOptions node_options) {
bool InsertNode(Head** head, NodeOptions node_options) {
if ((*head) == NULL) {
printf("Could not insert node into the list. List is empty.\n");

return false;
}

Node *current_node = (*head)->first_node;
Node *previous_node = current_node;
Node* current_node = (*head)->first_node;
Node* previous_node = current_node;

for (int i = 0; i < node_options.index; i++) {
previous_node = current_node;
Expand All @@ -112,7 +112,7 @@ bool InsertNode(Head **head, NodeOptions node_options) {
}
}

Node *node = malloc(sizeof(Node));
Node* node = malloc(sizeof(Node));

if (node == NULL) {
return false;
Expand All @@ -125,14 +125,14 @@ bool InsertNode(Head **head, NodeOptions node_options) {
return true;
}

void PrintList(Head **head) {
void PrintList(Head** head) {
if ((*head) == NULL) {
printf("List is empty.\n");

return;
}

Node *current_node = (*head)->first_node;
Node* current_node = (*head)->first_node;

wprintf(L"%lc HEAD %lc %p %lc %lc ", kVerticalLine, kVerticalLineDashed,
(*head)->first_node, kVerticalLine, kArrow);
Expand Down Expand Up @@ -187,17 +187,17 @@ int main() {
locale_t locale = newlocale(LC_CTYPE, "en_US", NULL);
uselocale(locale);

Head *head = NULL;
char *option_id_input = malloc(sizeof(char));
Head* head = NULL;
char* option_id_input = malloc(sizeof(char));
long option_id = -1;
char *input_one_string = malloc(sizeof(char));
char *input_two_string = malloc(sizeof(char));
char* input_one_string = malloc(sizeof(char));
char* input_two_string = malloc(sizeof(char));

PrintMenu();

while (option_id != kQuit) {
int number_of_assigned_input_items = 0;
char *end = NULL;
char* end = NULL;
long input_one_long = 0;
long input_two_long = 0;
bool success = false;
Expand Down
4 changes: 2 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ typedef struct NodeOptions {
typedef struct Node Node;

typedef struct Head {
Node *first_node;
Node* first_node;
} Head;

struct Node {
long data;
Node *next_node;
Node* next_node;
};

0 comments on commit 4f8141e

Please sign in to comment.