URI:
       Removing (hopefully) unneeded "b[i+1] = '\0'" - smu - smu - simple markup (Markdown) processor (fork, fixes + features)
  HTML git clone git://git.codemadness.org/smu
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit ec12d3a3b2623baf4cd457fe9122ae081f2cd783
   DIR parent 8d469f51deef8f33fa20393c36b69a0abec15e9e
  HTML Author: gottox@rootkit.lan <gottox@rootkit.lan>
       Date:   Sat, 15 Dec 2007 01:12:20 +0100
       
       Removing (hopefully) unneeded "b[i+1] = '\0'"
       
       Diffstat:
         M cmarkdown.c                         |       7 +++----
       
       1 file changed, 3 insertions(+), 4 deletions(-)
       ---
   DIR diff --git 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);