diff options
| author | gottox@rootkit.lan <gottox@rootkit.lan> | 2007-12-15 01:12:20 +0100 |
|---|---|---|
| committer | gottox@rootkit.lan <gottox@rootkit.lan> | 2007-12-15 01:12:20 +0100 |
| commit | ec12d3a3b2623baf4cd457fe9122ae081f2cd783 (patch) | |
| tree | 1e5342713947794eab11f55cfa75cb5df583e5ec | |
| parent | 8d469f51deef8f33fa20393c36b69a0abec15e9e (diff) | |
Removing (hopefully) unneeded "b[i+1] = '\0'"
| -rw-r--r-- | cmarkdown.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cmarkdown.c b/cmarkdown.c index c2cefbe..851b156 100644 --- a/cmarkdown.c +++ b/cmarkdown.c @@ -11,8 +11,8 @@ #define BUFFERSIZE 512 #define LENGTH(x) sizeof(x)/sizeof(x[0]) -#define ADDC(b,i) if((i + 1) % BUFFERSIZE == 0) \ - { b = realloc(b,((i + 1)+ BUFFERSIZE) * sizeof(b)); if(!b) eprint("Malloc failed."); }; b[i+1] = '\0'; b[i] +#define ADDC(b,i) if(i % BUFFERSIZE == 0) \ + { b = realloc(b,(i + BUFFERSIZE) * sizeof(b)); if(!b) eprint("Malloc failed."); }; b[i] typedef unsigned int (*Parser)(const char *, const char *, int); @@ -259,10 +259,8 @@ dolist(const char *begin, const char *end, int newblock) { } for(p++; *p && p != end && (*p == ' ' || *p == '\t'); p++); indent = p - q; - if(!(buffer = malloc(BUFFERSIZE))) eprint("Malloc failed."); - if(!newblock) putchar('\n'); fputs(ul ? "<ul>\n" : "<ol>\n",stdout); @@ -303,6 +301,7 @@ dolist(const char *begin, const char *end, int newblock) { } ADDC(buffer,i) = *p; } + ADDC(buffer,i) = '\0'; fputs("<li>",stdout); process(buffer,buffer+i,isblock); //TODO fputs("</li>\n",stdout); |