Provide our own isdigit macro. saves more than 400 bytes.
This commit is contained in:
parent
d686a045c8
commit
459903bd4e
@ -49,9 +49,8 @@ int head_main(int argc, char **argv)
|
|||||||
|
|
||||||
#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
|
#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
|
||||||
/* Allow legacy syntax of an initial numeric option without -n. */
|
/* Allow legacy syntax of an initial numeric option without -n. */
|
||||||
if ((argc > 1) && (argv[1][0] == '-')
|
if (argc > 1 && argv[1][0] == '-'
|
||||||
/* && (isdigit)(argv[1][1]) */
|
&& isdigit(argv[1][1])
|
||||||
&& (((unsigned int)(argv[1][1] - '0')) <= 9)
|
|
||||||
) {
|
) {
|
||||||
--argc;
|
--argc;
|
||||||
++argv;
|
++argv;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "busybox.h"
|
#include "busybox.h"
|
||||||
#include "dump.h"
|
#include "dump.h"
|
||||||
|
|
||||||
#define isdecdigit(c) (isdigit)(c)
|
#define isdecdigit(c) isdigit(c)
|
||||||
#define ishexdigit(c) (isxdigit)(c)
|
#define ishexdigit(c) (isxdigit)(c)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -93,7 +93,7 @@ static const char header_fmt[] = "\n==> %s <==\n";
|
|||||||
int tail_main(int argc, char **argv)
|
int tail_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
long count = 10;
|
long count = 10;
|
||||||
unsigned int sleep_period = 1;
|
unsigned sleep_period = 1;
|
||||||
int from_top = 0;
|
int from_top = 0;
|
||||||
int follow = 0;
|
int follow = 0;
|
||||||
int header_threshhold = 1;
|
int header_threshhold = 1;
|
||||||
@ -110,10 +110,9 @@ int tail_main(int argc, char **argv)
|
|||||||
|
|
||||||
#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
|
#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
|
||||||
/* Allow legacy syntax of an initial numeric option without -n. */
|
/* Allow legacy syntax of an initial numeric option without -n. */
|
||||||
if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-')
|
if (argc >= 2 && (argv[1][0] == '+' || argv[1][0] == '-')
|
||||||
/* && (isdigit)(argv[1][1]) */
|
&& isdigit(argv[1][1])
|
||||||
&& (((unsigned int)(argv[1][1] - '0')) <= 9))))
|
) {
|
||||||
{
|
|
||||||
optind = 2;
|
optind = 2;
|
||||||
optarg = argv[1];
|
optarg = argv[1];
|
||||||
goto GET_COUNT;
|
goto GET_COUNT;
|
||||||
|
@ -666,7 +666,6 @@ extern const char bb_default_login_shell[];
|
|||||||
#undef isascii
|
#undef isascii
|
||||||
#undef isblank
|
#undef isblank
|
||||||
#undef iscntrl
|
#undef iscntrl
|
||||||
#undef isdigit
|
|
||||||
#undef isgraph
|
#undef isgraph
|
||||||
#undef islower
|
#undef islower
|
||||||
#undef isprint
|
#undef isprint
|
||||||
@ -675,6 +674,11 @@ extern const char bb_default_login_shell[];
|
|||||||
#undef isupper
|
#undef isupper
|
||||||
#undef isxdigit
|
#undef isxdigit
|
||||||
|
|
||||||
|
/* This one is more efficient - we save ~400 bytes */
|
||||||
|
#undef isdigit
|
||||||
|
#define isdigit(a) ((unsigned)((a) - '0') <= 9)
|
||||||
|
|
||||||
|
|
||||||
#ifdef DMALLOC
|
#ifdef DMALLOC
|
||||||
#include <dmalloc.h>
|
#include <dmalloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -468,7 +468,7 @@ static int serveConnection(char *tmpbuf, int n_read)
|
|||||||
/* Parse the magic priority number. */
|
/* Parse the magic priority number. */
|
||||||
num_lt++;
|
num_lt++;
|
||||||
pri = 0;
|
pri = 0;
|
||||||
while (isdigit(*(++p))) {
|
while (isdigit(*++p)) {
|
||||||
pri = 10 * pri + (*p - '0');
|
pri = 10 * pri + (*p - '0');
|
||||||
}
|
}
|
||||||
if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) {
|
if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user