From: Michael Göhler Date: Tue, 30 Sep 2014 13:15:55 +0000 (+0200) Subject: use NULL instead of (void*)0 X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=2669a43752c6d8386826a1d96fa64c42d9cc77b9;p=smdp.git use NULL instead of (void*)0 --- diff --git a/src/markdown.c b/src/markdown.c index 2648dc1..d5dbe19 100644 --- a/src/markdown.c +++ b/src/markdown.c @@ -26,8 +26,8 @@ line_t *new_line() { line_t *x = malloc(sizeof(line_t)); - x->text = (void*)0; - x->prev = x->next = (void*)0; + x->text = NULL; + x->prev = x->next = NULL; x->bits = x->length = x->offset = 0; return x; } @@ -41,8 +41,8 @@ line_t *next_line(line_t *prev) { slide_t *new_slide() { slide_t *x = malloc(sizeof(slide_t)); - x->line = (void*)0; - x->prev = x->next = (void*)0; + x->line = NULL; + x->prev = x->next = NULL; x->lines = 0; return x; } @@ -56,8 +56,8 @@ slide_t *next_slide(slide_t *prev) { deck_t *new_deck() { deck_t *x = malloc(sizeof(deck_t)); - x->header = (void*)0; - x->slide = (void*)0; + x->header = NULL; + x->slide = new_slide(); x->slides = x->headers = 0; return x; } diff --git a/src/parser.c b/src/parser.c index e59f1be..04a0b49 100644 --- a/src/parser.c +++ b/src/parser.c @@ -36,19 +36,15 @@ deck_t *markdown_load(FILE *input) { int l = 0; // line length int hc = 0; // header count int lc = 0; // line count - int sc = 0; // slide count + int sc = 1; // slide count int bits = 0; // markdown bits deck_t *deck = new_deck(); - slide_t *slide = new_slide(); + slide_t *slide = deck->slide; line_t *line = NULL; line_t *tmp = NULL; cstring_t *text = cstring_init(); - // assign first slide to deck - deck->slide = slide; - sc++; - while ((c = fgetc(input)) != EOF) { if (ferror(input)) { fprintf(stderr, "markdown_load() failed to read input: %s\n", strerror(errno));