Tracec(tree != G2.static_ltree,
(stderr, "\nn %3d %c l %2d c %4x (%x) ", n,
- (isgraph(n) ? n : ' '), len, tree[n].Code,
+ (n > ' ' ? n : ' '), len, tree[n].Code,
next_code[len] - 1));
}
}
lc = G1.l_buf[lx++];
if ((flag & 1) == 0) {
SEND_CODE(lc, ltree); /* send a literal byte */
- Tracecv(isgraph(lc), (stderr, " '%c' ", lc));
+ Tracecv(lc > ' ', (stderr, " '%c' ", lc));
} else {
/* Here, lc is the match length - MIN_MATCH */
code = G2.length_code[lc];
#include "dump.h"
-#define isdecdigit(c) isdigit(c)
-#define ishexdigit(c) (isxdigit)(c)
-
static void
odoffset(dumper_t *dumper, int argc, char ***argvp)
{
if ((*p != '+')
&& (argc < 2
- || (!isdecdigit(p[0])
- && ((p[0] != 'x') || !ishexdigit(p[1])))))
+ || (!isdigit(p[0])
+ && ((p[0] != 'x') || !isxdigit(p[1])))))
return;
base = 0;
*/
if (p[0] == '+')
++p;
- if (p[0] == 'x' && ishexdigit(p[1])) {
+ if (p[0] == 'x' && isxdigit(p[1])) {
++p;
base = 16;
} else if (p[0] == '0' && p[1] == 'x') {
/* skip over the number */
if (base == 16)
- for (num = p; ishexdigit(*p); ++p)
+ for (num = p; isxdigit(*p); ++p)
continue;
else
- for (num = p; isdecdigit(*p); ++p)
+ for (num = p; isdigit(*p); ++p)
continue;
/* check for no number */
#define RB_POWER_OFF 0x4321fedc
#endif
-/* Make sure we call functions instead of macros. */
+/* Make sure we call functions instead of these macros */
#undef isalnum
+#undef ispunct
+#undef isxdigit
+/* and these we'll redefine */
#undef isalpha
#undef isascii
#undef isblank
#undef isgraph
#undef islower
#undef isprint
-#undef ispunct
#undef isupper
-#undef isxdigit
+#undef isdigit
+#undef isspace
/* This one is more efficient - we save ~500 bytes.
* BTW, x86 likes (unsigned char) cast more than (unsigned). */
-#undef isdigit
#define isdigit(a) ((unsigned char)((a) - '0') <= 9)
-/* This one is more efficient too! ~200 bytes */
+#define isascii(a) ((unsigned char)(a) <= 0x7f)
+#define isgraph(a) ((unsigned char)(a) > ' ')
+#define isprint(a) ((unsigned char)(a) >= ' ')
+#define isupper(a) ((unsigned char)((a) - 'A') <= ('Z' - 'A'))
+#define islower(a) ((unsigned char)((a) - 'a') <= ('z' - 'a'))
+#define isalpha(a) ((unsigned char)(((a) | 0x20) - 'a') <= ('z' - 'a'))
+#define isblank(a) ({ unsigned char bb__isblank = (a); bb__isblank == ' ' || bb__isblank == '\t'; })
+#define iscntrl(a) ({ unsigned char bb__iscntrl = (a); bb__iscntrl < ' ' || bb__iscntrl == 0x7f; })
+
/* In POSIX/C locale (the only locale we care about: do we REALLY want
* to allow Unicode whitespace in, say, .conf files? nuts!)
* isspace is only these chars: "\t\n\v\f\r" and space.
* "\t\n\v\f\r" happen to have ASCII codes 9,10,11,12,13.
* Use that.
*/
-#undef isspace
#define isspace(a) ({ unsigned char bb__isspace = (a) - 9; bb__isspace == (' ' - 9) || bb__isspace <= (13 - 9); })
+
#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
/* skip whitespace */
do {
c = getchar();
- if (c == EOF) exit(EXIT_FAILURE);
+ if (c == EOF)
+ exit(EXIT_FAILURE);
if (c == '\n') {
- if (!--cntdown) exit(EXIT_FAILURE);
+ if (!--cntdown)
+ exit(EXIT_FAILURE);
goto prompt;
}
- } while (isspace(c));
+ } while (isspace(c)); /* maybe isblank? */
*buf++ = c;
if (!fgets(buf, size_buf-2, stdin))
exit(EXIT_FAILURE);
if (!strchr(buf, '\n'))
exit(EXIT_FAILURE);
- while (isgraph(*buf)) buf++;
+ while ((unsigned char)*buf > ' ')
+ buf++;
*buf = '\0';
}
num_skip_chars = 1;
} else {
src = dst + 1;
- while ((isalnum)(*src) || *src == '_') src++;
+ while (isalnum(*src) || *src == '_') src++;
}
if (src == NULL) {
src = dst+dstlen;
line_buffer[--sz] = '\0';
line_ptr = line_buffer;
- while (*line_ptr && !isgraph(*line_ptr))
+ while (*line_ptr != '\0' && (unsigned char)*line_ptr <= ' ')
line_ptr++;
return *line_ptr;
}
while ((c = getopt(argc, argv, "q:m:s:Q:M:S:h?")) != -1) {
int result;
int id = 0;
- int iskey = (isupper)(c);
+ int iskey = isupper(c);
/* needed to delete semaphores */
union semun arg;