From a164c647acc613fe199a646dc5075c097f51a4a4 Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Mon, 5 Feb 2001 17:50:03 +0000 Subject: Make suffix_mult structures const. Thanks to Vladimir N. Oleynik. --- busybox.h | 3 ++- coreutils/dd.c | 2 +- coreutils/tail.c | 4 ++-- dd.c | 2 +- include/busybox.h | 3 ++- tail.c | 4 ++-- utility.c | 5 +++-- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/busybox.h b/busybox.h index fc5e8d8..2fc0cc7 100644 --- a/busybox.h +++ b/busybox.h @@ -167,7 +167,8 @@ struct suffix_mult { int mult; }; -extern unsigned long parse_number(const char *numstr, struct suffix_mult *suffixes); +extern unsigned long parse_number(const char *numstr, + const struct suffix_mult *suffixes); /* These parse entries in /etc/passwd and /etc/group. This is desirable diff --git a/coreutils/dd.c b/coreutils/dd.c index 5823106..75bbfba 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -30,7 +30,7 @@ #include #include -static struct suffix_mult dd_suffixes[] = { +static const struct suffix_mult dd_suffixes[] = { { "c", 1 }, { "w", 2 }, { "b", 512 }, diff --git a/coreutils/tail.c b/coreutils/tail.c index 40511aa..d45b29c 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -30,7 +30,7 @@ #include #include -static struct suffix_mult tail_suffixes[] = { +static const struct suffix_mult tail_suffixes[] = { { "b", 512 }, { "k", 1024 }, { "m", 1048576 }, @@ -38,7 +38,7 @@ static struct suffix_mult tail_suffixes[] = { }; #ifndef BB_FEATURE_SIMPLE_TAIL -static struct suffix_mult null_suffixes[] = { +static const struct suffix_mult null_suffixes[] = { { NULL, 0 } }; #endif diff --git a/dd.c b/dd.c index 5823106..75bbfba 100644 --- a/dd.c +++ b/dd.c @@ -30,7 +30,7 @@ #include #include -static struct suffix_mult dd_suffixes[] = { +static const struct suffix_mult dd_suffixes[] = { { "c", 1 }, { "w", 2 }, { "b", 512 }, diff --git a/include/busybox.h b/include/busybox.h index fc5e8d8..2fc0cc7 100644 --- a/include/busybox.h +++ b/include/busybox.h @@ -167,7 +167,8 @@ struct suffix_mult { int mult; }; -extern unsigned long parse_number(const char *numstr, struct suffix_mult *suffixes); +extern unsigned long parse_number(const char *numstr, + const struct suffix_mult *suffixes); /* These parse entries in /etc/passwd and /etc/group. This is desirable diff --git a/tail.c b/tail.c index 40511aa..d45b29c 100644 --- a/tail.c +++ b/tail.c @@ -30,7 +30,7 @@ #include #include -static struct suffix_mult tail_suffixes[] = { +static const struct suffix_mult tail_suffixes[] = { { "b", 512 }, { "k", 1024 }, { "m", 1048576 }, @@ -38,7 +38,7 @@ static struct suffix_mult tail_suffixes[] = { }; #ifndef BB_FEATURE_SIMPLE_TAIL -static struct suffix_mult null_suffixes[] = { +static const struct suffix_mult null_suffixes[] = { { NULL, 0 } }; #endif diff --git a/utility.c b/utility.c index f99c613..aa1fa94 100644 --- a/utility.c +++ b/utility.c @@ -1696,9 +1696,10 @@ struct BB_applet *find_applet_by_name(const char *name) } #if defined BB_DD || defined BB_TAIL -unsigned long parse_number(const char *numstr, struct suffix_mult *suffixes) +unsigned long parse_number(const char *numstr, + const struct suffix_mult *suffixes) { - struct suffix_mult *sm; + const struct suffix_mult *sm; unsigned long int ret; int len; char *end; -- cgit v1.1