Changeset 4654 for zzuf


Ignore:
Timestamp:
Sep 22, 2010, 10:34:37 PM (9 years ago)
Author:
Sam Hocevar
Message:

Fix a bug caused by undefined function call precedence.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/zzat.c

    r4653 r4654  
    357357};
    358358
    359 static int make_fmt(struct parser *p, char const *fmt)
     359static int make_fmt(struct parser *p, char const *fmt, int *nitems)
    360360{
    361361    char const *tmp;
     
    375375            tmp++, ret++;
    376376
    377     return ret;
     377    *nitems = ret;
     378
     379    return 1;
    378380}
    379381
    380382#define PARSECMD(fmt, ...) \
    381     (make_fmt(&parser, fmt) == sscanf(sequence, parser.tmpfmt, \
    382                                       __VA_ARGS__, &parser.ch) \
     383    (make_fmt(&parser, fmt, &nitems) \
     384         && nitems == sscanf(sequence, parser.tmpfmt, \
     385                             ##__VA_ARGS__, &parser.ch) \
    383386         && parser.ch == parser.lastch)
    384387
     
    394397    FILE *f = NULL;
    395398    size_t retlen = 0, retoff = 0;
    396     int nloops = 0, fd = -1, feofs = 0, finish = 0;
     399    int nitems, nloops = 0, fd = -1, feofs = 0, finish = 0;
    397400
    398401    /* Initialise per-file state */
Note: See TracChangeset for help on using the changeset viewer.