From e7e3c53167857875573b2732d9f329873586b04a Mon Sep 17 00:00:00 2001 From: Mike Lowis Date: Thu, 28 Jul 2016 10:44:47 -0400 Subject: [PATCH] Implemente plan9 header style: Remove includes and include guards from all headers except util.h. Programs should include dependencies before including the header. --- source/bstree.h | 7 ------- source/hash.h | 9 --------- source/lex.h | 7 ------- source/list.h | 7 ------- source/parse.h | 9 --------- source/slist.h | 7 ------- source/strbuf.h | 7 ------- source/utf8.h | 8 -------- source/util.h | 4 ---- source/vec.h | 10 ---------- 10 files changed, 75 deletions(-) diff --git a/source/bstree.h b/source/bstree.h index 423222c..ab53c68 100644 --- a/source/bstree.h +++ b/source/bstree.h @@ -3,11 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef BSTREE_H -#define BSTREE_H - -#include -#include typedef struct bstree_node_t { struct bstree_node_t* left; @@ -72,5 +67,3 @@ static bstree_node_t* bstree_lookup(bstree_t* tree, bstree_node_t* node) { bstree_node_t** curr = find_node(tree->cmpfn, &(tree->root), node, false); return *curr; } - -#endif /* BSTREE_H */ diff --git a/source/hash.h b/source/hash.h index 7999253..d2cb62b 100644 --- a/source/hash.h +++ b/source/hash.h @@ -3,13 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef HASH_H -#define HASH_H - -#include -#include -#include -#include typedef struct hash_entry_t { unsigned int hash; @@ -197,5 +190,3 @@ static bool hash_del(hash_t* hash, hash_entry_t* entry) { } return ret; } - -#endif /* HASH_H */ diff --git a/source/lex.h b/source/lex.h index 562c21c..a745570 100644 --- a/source/lex.h +++ b/source/lex.h @@ -3,11 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef LEX_H -#define LEX_H - -#include -#include typedef struct lex_ctx_t { FILE* input; @@ -163,5 +158,3 @@ static bool is_hex(Rune r) { static bool is_alnum(Rune r) { return (is_alpha(r) || isdec(r)); } - -#endif diff --git a/source/list.h b/source/list.h index e5c24e5..9d63b41 100644 --- a/source/list.h +++ b/source/list.h @@ -3,11 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef LIST_H -#define LIST_H - -#include -#include typedef struct list_node_t { struct list_node_t* next; @@ -95,5 +90,3 @@ static bool list_node_has_prev(list_node_t* node) { static list_node_t* list_node_prev(list_node_t* node) { return node->prev; } - -#endif /* LIST_H */ diff --git a/source/parse.h b/source/parse.h index e510831..a4bf058 100644 --- a/source/parse.h +++ b/source/parse.h @@ -3,13 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef PARSE_H -#define PARSE_H - -#include -#include -#include -#include /* NOTE: The tokval_t is left undefined in this header file. It is intended @@ -143,5 +136,3 @@ static void release(parser_t* ctx) { ctx->markcount--; seek(ctx, marker); } - -#endif /* PARSE_H */ diff --git a/source/slist.h b/source/slist.h index 2786300..7fab57e 100644 --- a/source/slist.h +++ b/source/slist.h @@ -3,11 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef SLIST_H -#define SLIST_H - -#include -#include typedef struct slist_node_t { struct slist_node_t* next; @@ -91,5 +86,3 @@ static slist_node_t* slist_node_next(slist_node_t* node) { #define slist_foreach(elem, list) \ for(slist_node_t* elem = slist_front(list); elem != NULL; elem = elem->next) - -#endif /* SLIST_H */ diff --git a/source/strbuf.h b/source/strbuf.h index 2cc81a1..3eeee9e 100644 --- a/source/strbuf.h +++ b/source/strbuf.h @@ -3,11 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef STRBUF_H -#define STRBUF_H - -#include -#include typedef struct { size_t index; @@ -66,5 +61,3 @@ static void strbuf_add_rune(strbuf_t* buf, Rune rune) { static void strbuf_cat(strbuf_t* dest, strbuf_t* src) { strbuf_add_string(dest, strbuf_string(src)); } - -#endif /* STRBUF_H */ diff --git a/source/utf8.h b/source/utf8.h index e30c0b9..684e830 100644 --- a/source/utf8.h +++ b/source/utf8.h @@ -3,12 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef UTF8_H -#define UTF8_H - -#include -#include -#include typedef uint32_t Rune; @@ -107,5 +101,3 @@ static void fputrune(Rune rune, FILE* f) { utf8encode(utf, rune); fprintf(f, "%s", utf); } - -#endif /* UTF8_H */ diff --git a/source/util.h b/source/util.h index 2e4405a..c01b700 100644 --- a/source/util.h +++ b/source/util.h @@ -3,8 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef UTIL_H -#define UTIL_H /* Standard Macros and Types */ #include @@ -283,5 +281,3 @@ static inline char* _getopt_(int* p_argc, char*** p_argv) { #define static_assert(expr) \ typedef char unique_id[( expr )?1:-1] #endif - -#endif diff --git a/source/vec.h b/source/vec.h index d01a20c..2abfd3f 100644 --- a/source/vec.h +++ b/source/vec.h @@ -3,14 +3,6 @@ @author Michael D. Lowis @license BSD 2-clause License */ -#ifndef VEC_H -#define VEC_H - -#include -#include -#include -#include -#include typedef struct { size_t elem_count; @@ -115,5 +107,3 @@ static void vec_pop_back(vec_t* vec, void* outdata) { static void vec_clear(vec_t* vec) { vec->elem_count = 0; } - -#endif /* VEC_H */ -- 2.52.0