Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-17 02:49:13 +0300
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-17 02:49:13 +0300
commit9f739445cd3deddd0343c3a8d5a981ede26bef30 (patch)
tree6dc013e44d2281eb1e6f61c4bca1ae7546001f79 /coreutils/sum.c
parenta597aaddfa76d589d3e1a37b1f1c3401c2decffd (diff)
inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]
Diffstat (limited to 'coreutils/sum.c')
-rw-r--r--coreutils/sum.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/coreutils/sum.c b/coreutils/sum.c
index 93f4e22eb..68a857816 100644
--- a/coreutils/sum.c
+++ b/coreutils/sum.c
@@ -18,9 +18,6 @@
/* 1 if any of the files read were the standard input */
static int have_read_stdin;
-/* make a little more readable and avoid using strcmp for just 2 bytes */
-#define IS_STDIN(s) (s[0] == '-' && s[1] == '\0')
-
/* Calculate and print the rotated checksum and the size in 1K blocks
of file FILE, or of the standard input if FILE is "-".
If PRINT_NAME is >1, print FILE next to the checksum and size.
@@ -34,7 +31,7 @@ static int bsd_sum_file(const char *file, int print_name)
int ch; /* Each character read. */
int ret = 0;
- if (IS_STDIN(file)) {
+ if (LONE_DASH(file)) {
fp = stdin;
have_read_stdin++;
} else {
@@ -84,7 +81,7 @@ static int sysv_sum_file(const char *file, int print_name)
/* The sum of all the input bytes, modulo (UINT_MAX + 1). */
unsigned int s = 0;
- if (IS_STDIN(file)) {
+ if (LONE_DASH(file)) {
fd = 0;
have_read_stdin = 1;
} else {
@@ -103,7 +100,7 @@ static int sysv_sum_file(const char *file, int print_name)
release_and_ret:
bb_perror_msg(file);
RELEASE_CONFIG_BUFFER(buf);
- if (!IS_STDIN(file))
+ if (NOT_LONE_DASH(file))
close(fd);
return 0;
}
@@ -113,7 +110,7 @@ release_and_ret:
s += buf[bytes_read];
}
- if (!IS_STDIN(file) && close(fd) == -1)
+ if (NOT_LONE_DASH(file) && close(fd) == -1)
goto release_and_ret;
else
RELEASE_CONFIG_BUFFER(buf);