mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-22 10:32:59 +02:00
qpkg/gobble.c (EXPECT): added variant that just skips over expected text
If the package database is sane, then we don't need to check that all the field names match what we expect. This saves a few more CPU cycles. However, if anything goes wrong, the consequences may be unpleasant. Thus, we default to the slow but safe approach.
This commit is contained in:
parent
03c5e4ffe7
commit
ed0281f306
@ -15,16 +15,24 @@
|
||||
#define CHARS_AFTER_ERROR 20
|
||||
|
||||
|
||||
#ifdef BREAKNECK_SPEED
|
||||
|
||||
#define EXPECT(s) do { buf += sizeof(s)-1; } while (0)
|
||||
|
||||
#else /* !BREAKNECK_SPEED */
|
||||
|
||||
#define EXPECT(s) \
|
||||
do { \
|
||||
if (end-buf < sizeof(s)-1) \
|
||||
FAIL; \
|
||||
FAIL; \
|
||||
if (memcmp(buf, s, sizeof(s)-1)) \
|
||||
FAIL; \
|
||||
buf += sizeof(s)-1; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define NEXT (buf == end ? '?' : *buf++)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user