Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Commit Details
Date: | 2010-11-20 02:29:19 (13 years 4 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | ed0281f306bdc30a018eeb6e6723148c514ec1dc |
Message: | 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. |
Files: |
qpkg/gobble.c (1 diff) |
Change Details
qpkg/gobble.c | ||
---|---|---|
15 | 15 | #define CHARS_AFTER_ERROR 20 |
16 | 16 | |
17 | 17 | |
18 | #ifdef BREAKNECK_SPEED | |
19 | ||
20 | #define EXPECT(s) do { buf += sizeof(s)-1; } while (0) | |
21 | ||
22 | #else /* !BREAKNECK_SPEED */ | |
23 | ||
18 | 24 | #define EXPECT(s) \ |
19 | 25 | do { \ |
20 | 26 | if (end-buf < sizeof(s)-1) \ |
21 | FAIL; \ | |
27 | FAIL; \ | |
22 | 28 | if (memcmp(buf, s, sizeof(s)-1)) \ |
23 | 29 | FAIL; \ |
24 | 30 | buf += sizeof(s)-1; \ |
25 | 31 | } \ |
26 | 32 | while (0) |
27 | 33 | |
34 | #endif | |
35 | ||
28 | 36 | |
29 | 37 | #define NEXT (buf == end ? '?' : *buf++) |
30 | 38 |
Branches:
master