Small cleanup: use passed buflen in stinit:next_block

Instead of assuming all passed buffers are DEFMAX, use the given
buflen. Also change some types (int→size_t) since these are all
related to string sizes.
This commit is contained in:
Iustin Pop
2016-05-02 01:09:36 +02:00
parent 22df208f19
commit 95c0789085

View File

@@ -209,9 +209,9 @@ num_arg(char *t)
static int
next_block(FILE *dbf, char *buf, int buflen __attribute__((unused)), int limiter)
next_block(FILE *dbf, char *buf, size_t buflen, int limiter)
{
int len;
size_t len;
char *cp, *bp;
static char lbuf[LINEMAX];
@@ -231,7 +231,7 @@ next_block(FILE *dbf, char *buf, int buflen __attribute__((unused)), int limiter
memmove(lbuf, cp, strlen(cp) + 1);
return TRUE;
}
if (len + strlen(lbuf) >= DEFMAX) {
if (len + strlen(lbuf) >= buflen) {
fprintf(stderr, "Too long definition: '%s'\n", buf);
return FALSE;
}