Compare commits
	
		
			No commits in common. "263cb19258e992a3d3c0ebfc83fb92007d7b73d5" and "58e31c99a7cdd7b54204e9d33795f78b90feeb31" have entirely different histories.
		
	
	
		
			263cb19258
			...
			58e31c99a7
		
	
		
					 5 changed files with 7 additions and 42 deletions
				
			
		
							
								
								
									
										8
									
								
								Doxyfile
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								Doxyfile
									
										
									
									
									
								
							| 
						 | 
					@ -1,10 +1,6 @@
 | 
				
			||||||
PROJECT_NAME = CTree
 | 
					PROJECT_NAME = MyProject
 | 
				
			||||||
PROJECT_NUMBER = $(PROJECT_NUMBER)
 | 
					PROJECT_NUMBER = 1.0
 | 
				
			||||||
INPUT = src
 | 
					INPUT = src
 | 
				
			||||||
RECURSIVE = YES
 | 
					 | 
				
			||||||
EXTRACT_ALL = YES
 | 
					 | 
				
			||||||
INPUT += README.md
 | 
					 | 
				
			||||||
USE_MDFILE_AS_MAINPAGE = README.md
 | 
					 | 
				
			||||||
OUTPUT_DIRECTORY = docs
 | 
					OUTPUT_DIRECTORY = docs
 | 
				
			||||||
#EXCLUDE = /path/to/exclude/directory
 | 
					#EXCLUDE = /path/to/exclude/directory
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										4
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
					@ -1,8 +1,6 @@
 | 
				
			||||||
# Compiler
 | 
					# Compiler
 | 
				
			||||||
CC := gcc
 | 
					CC := gcc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GITHASH := $(shell git rev-parse --short HEAD)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Compiler flags
 | 
					# Compiler flags
 | 
				
			||||||
CFLAGS := -Wall -Wextra -Wpedantic -std=c2x
 | 
					CFLAGS := -Wall -Wextra -Wpedantic -std=c2x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +44,7 @@ clean:
 | 
				
			||||||
	rm -rf $(BUILD_DIR) $(TARGET)
 | 
						rm -rf $(BUILD_DIR) $(TARGET)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
docs:
 | 
					docs:
 | 
				
			||||||
	PROJECT_NUMBER=git-$(GITHASH) doxygen Doxyfile
 | 
						doxygen Doxyfile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cppcheck:
 | 
					cppcheck:
 | 
				
			||||||
	cppcheck --enable=all --inconclusive --std=c11 --language=c --platform=unix64 --suppress=missingIncludeSystem $(SRCS)
 | 
						cppcheck --enable=all --inconclusive --std=c11 --language=c --platform=unix64 --suppress=missingIncludeSystem $(SRCS)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +0,0 @@
 | 
				
			||||||
# CTree Example Project
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sample project for the CTree library. Testing out writing C with best practices in mind.
 | 
					 | 
				
			||||||
| 
						 | 
					@ -7,15 +7,6 @@
 | 
				
			||||||
#define ANSI_COLOR_RED "\x1b[31m"
 | 
					#define ANSI_COLOR_RED "\x1b[31m"
 | 
				
			||||||
#define ANSI_COLOR_RESET "\x1b[0m"
 | 
					#define ANSI_COLOR_RESET "\x1b[0m"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * @brief Assert a condition
 | 
					 | 
				
			||||||
 * @details If the condition is false, print an error message
 | 
					 | 
				
			||||||
 *          and exit the program
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param condition The condition to assert
 | 
					 | 
				
			||||||
 * @param message The message to print if the condition is false
 | 
					 | 
				
			||||||
 * @return 0 if the condition is true
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
int assert(bool condition, const char *message) {
 | 
					int assert(bool condition, const char *message) {
 | 
				
			||||||
  if (!condition) {
 | 
					  if (!condition) {
 | 
				
			||||||
    printf(ANSI_COLOR_RED "Assertion failed: %s\n" ANSI_COLOR_RESET, message);
 | 
					    printf(ANSI_COLOR_RED "Assertion failed: %s\n" ANSI_COLOR_RESET, message);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								src/tree.h
									
										
									
									
									
								
							
							
						
						
									
										25
									
								
								src/tree.h
									
										
									
									
									
								
							| 
						 | 
					@ -5,37 +5,20 @@
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					// A regular node with a left and right branch
 | 
				
			||||||
 * @brief A node in a binary tree
 | 
					 | 
				
			||||||
 * @details A node in a binary tree has some data
 | 
					 | 
				
			||||||
 *          and can have a left and right branch
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct Node {
 | 
					struct Node {
 | 
				
			||||||
  /** @brief The data of the node */
 | 
					 | 
				
			||||||
  int data;
 | 
					  int data;
 | 
				
			||||||
 | 
					  struct Node *left, *right;
 | 
				
			||||||
   /** @see Node */
 | 
					 | 
				
			||||||
  struct Node *left;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /** @see Node */
 | 
					 | 
				
			||||||
  struct Node *right;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
typedef struct Node Node;
 | 
					typedef struct Node Node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** @brief Represents a tree with a root node */
 | 
					// Represents a tree with a root node
 | 
				
			||||||
struct Tree {
 | 
					struct Tree {
 | 
				
			||||||
  /** @brief The root node of the tree */
 | 
					 | 
				
			||||||
  Node *root;
 | 
					  Node *root;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
typedef struct Tree Tree;
 | 
					typedef struct Tree Tree;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					// Insert some data into the tree
 | 
				
			||||||
 * @brief Insert some data into the tree
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 * @param tree 
 | 
					 | 
				
			||||||
 * @param data 
 | 
					 | 
				
			||||||
 * @return * Insert 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
int tree_insert(Tree *tree, int data);
 | 
					int tree_insert(Tree *tree, int data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Remove some data from the tree
 | 
					// Remove some data from the tree
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue