use NULL instead of (void*)0
authorMichael Göhler <somebody.here@gmx.de>
Tue, 30 Sep 2014 13:15:55 +0000 (15:15 +0200)
committerMichael Göhler <somebody.here@gmx.de>
Tue, 30 Sep 2014 13:15:55 +0000 (15:15 +0200)
src/markdown.c
src/parser.c

index 2648dc1..d5dbe19 100644 (file)
@@ -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;
 }
index e59f1be..04a0b49 100644 (file)
@@ -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));