Removing (hopefully) unneeded "b[i+1] = '\0'"
This commit is contained in:
parent
8d469f51de
commit
ec12d3a3b2
1 changed files with 3 additions and 4 deletions
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
#define BUFFERSIZE 512
|
#define BUFFERSIZE 512
|
||||||
#define LENGTH(x) sizeof(x)/sizeof(x[0])
|
#define LENGTH(x) sizeof(x)/sizeof(x[0])
|
||||||
#define ADDC(b,i) if((i + 1) % BUFFERSIZE == 0) \
|
#define ADDC(b,i) if(i % BUFFERSIZE == 0) \
|
||||||
{ b = realloc(b,((i + 1)+ BUFFERSIZE) * sizeof(b)); if(!b) eprint("Malloc failed."); }; b[i+1] = '\0'; b[i]
|
{ b = realloc(b,(i + BUFFERSIZE) * sizeof(b)); if(!b) eprint("Malloc failed."); }; b[i]
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned int (*Parser)(const char *, const char *, int);
|
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++);
|
for(p++; *p && p != end && (*p == ' ' || *p == '\t'); p++);
|
||||||
indent = p - q;
|
indent = p - q;
|
||||||
|
|
||||||
if(!(buffer = malloc(BUFFERSIZE)))
|
if(!(buffer = malloc(BUFFERSIZE)))
|
||||||
eprint("Malloc failed.");
|
eprint("Malloc failed.");
|
||||||
|
|
||||||
if(!newblock)
|
if(!newblock)
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
fputs(ul ? "<ul>\n" : "<ol>\n",stdout);
|
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) = *p;
|
||||||
}
|
}
|
||||||
|
ADDC(buffer,i) = '\0';
|
||||||
fputs("<li>",stdout);
|
fputs("<li>",stdout);
|
||||||
process(buffer,buffer+i,isblock); //TODO
|
process(buffer,buffer+i,isblock); //TODO
|
||||||
fputs("</li>\n",stdout);
|
fputs("</li>\n",stdout);
|
||||||
|
|
Loading…
Add table
Reference in a new issue