refactor(object, utilities): moved diff saving and reading to the object files

This commit is contained in:
lisk77 2025-09-19 19:22:40 +02:00
parent 13e3ba70b2
commit 4b2575ab96
4 changed files with 378 additions and 402 deletions

View file

@ -24,9 +24,12 @@
#include "hash.h"
#include "file.h"
#include "tree.h"
#include "utilities.h"
#include "common.h"
char* get_object(char*, size_t*);
void* parse_object(char*, ObjectType, size_t*);
int save_diff(ActionList*, char*, char*, size_t, char*, File*, int);
int read_diff(char*, char*, ActionList*);
int save_file_diff(char*, char*, size_t, char*, Changes*);
#endif // OBJECT_H

View file

@ -9,11 +9,6 @@
#include "myers.h"
#include "action_list.h"
#define IS_ALPHA(c) ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
#define IS_DIGIT(c) (c >= '0' && c <= '9')
#define IS_ALNUM(c) (IS_ALPHA(c) || IS_DIGIT(c))
#define IS_PUNCT(c) ((c >= 33 && c <= 47) || (c >= 58 && c <= 64) || (c >= 91 && c <= 96) || (c >= 123 && c <= 126))
#define RESET "\033[0m"
#define RED_BG "\033[41m"
#define GREEN_BG "\033[42m"
@ -29,10 +24,6 @@ typedef enum {
typedef List StringBuffer;
typedef struct {
uint32_t insertions;
uint32_t deletions;
} Changes;
StringBuffer* string_buffer_new();
int string_buffer_push(StringBuffer*, char*);
@ -42,15 +33,12 @@ char* find_root(char*);
void walk(char*, char*, char*, FileInfoBuffer*, int, char*);
char* get_repo_path(char*, char*);
int is_in_repo(char*, char*);
void visualize_diff(File*, File*, ActionList*);
int cut_path(char*, char*);
void combine_path(char*, char*);
PathType get_path_type(const char*);
char* get_file_content(char*);
char* get_file_content_with_size(char*, size_t*);
int create_default_config_file(char*);
int save_diff(ActionList*, char*, char*, size_t, char*, File*, int);
int read_diff(char*, char*, ActionList*);
int save_file_diff(char*, char*, size_t, char*, Changes*);
#endif // UTILITIES_H