From a565247c8e000482a4136a4e0f5bd113102a6d65 Mon Sep 17 00:00:00 2001 From: El-BG-1970 Date: Sun, 5 Feb 2023 11:48:36 +0100 Subject: added checks, moved from defines to pragma in header files --- Makefile | 10 +++++++--- agenda_entry.h | 7 ++----- date.h | 7 ++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index ac99cf1..8a71ad6 100644 --- a/Makefile +++ b/Makefile @@ -6,16 +6,17 @@ CC=clang --std=gnu99 CC=clang --std=c99 .endif -CFLAGS=-Wall -Wextra -Werror -g +CFLAGS=-Wall -Wextra -Werror -Weverything -pedantic LIBS= -BLDFLAGS=-O2 -g +BLDFLAGS=-g +RELFLAGS=-O2 TARGET=otc DEPS=main.c agenda_entry.c date.c HEAD=agenda_entry.h date.h OBJ=${DEPS:.c=.o} -.PHONY: all clean $(TARGET) +.PHONY: all clean release $(TARGET) all: $(TARGET) @@ -27,5 +28,8 @@ $(OBJ): $(HEAD) $(TARGET): $(OBJ) $(CC) -o $@ $(OBJ) $(LIBS) $(BLDFLAGS) +release: $(OBJ) + $(CC) -o $(TARGET) $(OBJ) $(LIBS) $(RELFLAGS) + clean: rm -f *.o *~ *.core $(OBJ) $(TARGET) diff --git a/agenda_entry.h b/agenda_entry.h index 8f13b2d..ea9ea8a 100644 --- a/agenda_entry.h +++ b/agenda_entry.h @@ -1,4 +1,4 @@ -#ifndef __AGENDA_ENTRY_H__ +#pragma once #include #include #include "date.h" @@ -8,10 +8,10 @@ typedef struct entry { //struct entry *children; //int8_t level;// nesting level of the entry //char *todo; // TODO keyword + Date date; // scheduled or deadline date char *tag; // tag keyword char *title; // the actual entry //char *text; // description (if there is one) - Date date; // scheduled or deadline date } entry; char *next_word(char *str); @@ -27,6 +27,3 @@ void merge_sort_entry_array(entry *arr, int n); void sort_entry_array(entry *arr, int n); void print_entry(entry e); void destroy_entry(entry e); - -#define __AGENDA_ENTRY_H__ -#endif diff --git a/date.h b/date.h index b692d48..5adfc46 100644 --- a/date.h +++ b/date.h @@ -1,4 +1,4 @@ -#ifndef __DATE_H__ +#pragma once #include #include #include @@ -28,11 +28,8 @@ void print_date(Date date); char *print_date_to_string(Date date); char *short_date_to_string(Date date); -Date today(); +Date today(void); Date tomorrow(Date td); Date nextweek(Date td); Date nextmonth(Date td); Date nextmonday(Date td); - -#define __DATE_H__ -#endif -- cgit v1.2.3