aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-10-20 11:17:48 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-10-20 11:17:48 +0000
commit1f0262bcdb352e9a75a4e5f48cd63d05714e2859 (patch)
treee191e1f4019e7b0daf47f9077e375588f77b3c6a
parent0fa9deda1706b19e5f42ed392483a582880aaca3 (diff)
downloadbusybox-w32-1f0262bcdb352e9a75a4e5f48cd63d05714e2859.tar.gz
busybox-w32-1f0262bcdb352e9a75a4e5f48cd63d05714e2859.tar.bz2
busybox-w32-1f0262bcdb352e9a75a4e5f48cd63d05714e2859.zip
another more const
-rw-r--r--coreutils/ls.c2
-rw-r--r--coreutils/stat.c4
-rw-r--r--e2fsprogs/e2p/feature.c9
-rw-r--r--e2fsprogs/e2p/hashstr.c6
-rw-r--r--e2fsprogs/e2p/mntopts.c9
-rw-r--r--e2fsprogs/e2p/ostype.c7
-rw-r--r--e2fsprogs/e2p/pf.c4
-rw-r--r--e2fsprogs/fsck.c11
-rw-r--r--miscutils/adjtimex.c6
-rw-r--r--modutils/insmod.c2
-rw-r--r--util-linux/nfsmount.c2
-rw-r--r--util-linux/readprofile.c6
12 files changed, 33 insertions, 35 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index d8d814a74..5042c1298 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -170,7 +170,7 @@ static int show_color = 0;
170 170
171/* long option entry used only for --color, which has no short option 171/* long option entry used only for --color, which has no short option
172 * equivalent. */ 172 * equivalent. */
173static struct option ls_color_opt[] = 173static const struct option ls_color_opt[] =
174{ 174{
175 {"color", optional_argument, NULL, 1}, 175 {"color", optional_argument, NULL, 1},
176 {NULL, 0, NULL, 0} 176 {NULL, 0, NULL, 0}
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 138cc9e8b..c17b4d5e8 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -81,9 +81,9 @@ static char const *human_time(time_t t)
81static char const *human_fstype(long f_type) 81static char const *human_fstype(long f_type)
82{ 82{
83 int i; 83 int i;
84 static struct types { 84 static const struct types {
85 long type; 85 long type;
86 char *fs; 86 const char *fs;
87 } humantypes[] = { 87 } humantypes[] = {
88 { 0xADFF, "affs" }, 88 { 0xADFF, "affs" },
89 { 0x1Cd1, "devpts" }, 89 { 0x1Cd1, "devpts" },
diff --git a/e2fsprogs/e2p/feature.c b/e2fsprogs/e2p/feature.c
index a4f3c64cb..fe6016102 100644
--- a/e2fsprogs/e2p/feature.c
+++ b/e2fsprogs/e2p/feature.c
@@ -22,7 +22,7 @@ struct feature {
22 const char *string; 22 const char *string;
23}; 23};
24 24
25static struct feature feature_list[] = { 25static const struct feature feature_list[] = {
26 { E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_DIR_PREALLOC, 26 { E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_DIR_PREALLOC,
27 "dir_prealloc" }, 27 "dir_prealloc" },
28 { E2P_FEATURE_COMPAT, EXT3_FEATURE_COMPAT_HAS_JOURNAL, 28 { E2P_FEATURE_COMPAT, EXT3_FEATURE_COMPAT_HAS_JOURNAL,
@@ -56,7 +56,7 @@ static struct feature feature_list[] = {
56 56
57const char *e2p_feature2string(int compat, unsigned int mask) 57const char *e2p_feature2string(int compat, unsigned int mask)
58{ 58{
59 struct feature *f; 59 const struct feature *f;
60 static char buf[20]; 60 static char buf[20];
61 char fchar; 61 char fchar;
62 int fnum; 62 int fnum;
@@ -87,7 +87,7 @@ const char *e2p_feature2string(int compat, unsigned int mask)
87 87
88int e2p_string2feature(char *string, int *compat_type, unsigned int *mask) 88int e2p_string2feature(char *string, int *compat_type, unsigned int *mask)
89{ 89{
90 struct feature *f; 90 const struct feature *f;
91 char *eptr; 91 char *eptr;
92 int num; 92 int num;
93 93
@@ -154,8 +154,7 @@ int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array)
154 unsigned int mask; 154 unsigned int mask;
155 int compat_type; 155 int compat_type;
156 156
157 buf = xmalloc(strlen(str)+1); 157 buf = bb_xstrdup(str);
158 strcpy(buf, str);
159 cp = buf; 158 cp = buf;
160 while (cp && *cp) { 159 while (cp && *cp) {
161 neg = 0; 160 neg = 0;
diff --git a/e2fsprogs/e2p/hashstr.c b/e2fsprogs/e2p/hashstr.c
index 7c0552f09..c4b3f9fd5 100644
--- a/e2fsprogs/e2p/hashstr.c
+++ b/e2fsprogs/e2p/hashstr.c
@@ -21,7 +21,7 @@ struct hash {
21 const char *string; 21 const char *string;
22}; 22};
23 23
24static struct hash hash_list[] = { 24static const struct hash hash_list[] = {
25 { EXT2_HASH_LEGACY, "legacy" }, 25 { EXT2_HASH_LEGACY, "legacy" },
26 { EXT2_HASH_HALF_MD4, "half_md4" }, 26 { EXT2_HASH_HALF_MD4, "half_md4" },
27 { EXT2_HASH_TEA, "tea" }, 27 { EXT2_HASH_TEA, "tea" },
@@ -30,7 +30,7 @@ static struct hash hash_list[] = {
30 30
31const char *e2p_hash2string(int num) 31const char *e2p_hash2string(int num)
32{ 32{
33 struct hash *p; 33 const struct hash *p;
34 static char buf[20]; 34 static char buf[20];
35 35
36 for (p = hash_list; p->string; p++) { 36 for (p = hash_list; p->string; p++) {
@@ -46,7 +46,7 @@ const char *e2p_hash2string(int num)
46 */ 46 */
47int e2p_string2hash(char *string) 47int e2p_string2hash(char *string)
48{ 48{
49 struct hash *p; 49 const struct hash *p;
50 char *eptr; 50 char *eptr;
51 int num; 51 int num;
52 52
diff --git a/e2fsprogs/e2p/mntopts.c b/e2fsprogs/e2p/mntopts.c
index 735260ce0..562a9ccc1 100644
--- a/e2fsprogs/e2p/mntopts.c
+++ b/e2fsprogs/e2p/mntopts.c
@@ -21,7 +21,7 @@ struct mntopt {
21 const char *string; 21 const char *string;
22}; 22};
23 23
24static struct mntopt mntopt_list[] = { 24static const struct mntopt mntopt_list[] = {
25 { EXT2_DEFM_DEBUG, "debug" }, 25 { EXT2_DEFM_DEBUG, "debug" },
26 { EXT2_DEFM_BSDGROUPS, "bsdgroups" }, 26 { EXT2_DEFM_BSDGROUPS, "bsdgroups" },
27 { EXT2_DEFM_XATTR_USER, "user_xattr" }, 27 { EXT2_DEFM_XATTR_USER, "user_xattr" },
@@ -35,7 +35,7 @@ static struct mntopt mntopt_list[] = {
35 35
36const char *e2p_mntopt2string(unsigned int mask) 36const char *e2p_mntopt2string(unsigned int mask)
37{ 37{
38 struct mntopt *f; 38 const struct mntopt *f;
39 static char buf[20]; 39 static char buf[20];
40 int fnum; 40 int fnum;
41 41
@@ -50,7 +50,7 @@ const char *e2p_mntopt2string(unsigned int mask)
50 50
51int e2p_string2mntopt(char *string, unsigned int *mask) 51int e2p_string2mntopt(char *string, unsigned int *mask)
52{ 52{
53 struct mntopt *f; 53 const struct mntopt *f;
54 char *eptr; 54 char *eptr;
55 int num; 55 int num;
56 56
@@ -99,8 +99,7 @@ int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok)
99 int neg; 99 int neg;
100 unsigned int mask; 100 unsigned int mask;
101 101
102 buf = xmalloc(strlen(str)+1); 102 buf = bb_xstrdup(str);
103 strcpy(buf, str);
104 cp = buf; 103 cp = buf;
105 while (cp && *cp) { 104 while (cp && *cp) {
106 neg = 0; 105 neg = 0;
diff --git a/e2fsprogs/e2p/ostype.c b/e2fsprogs/e2p/ostype.c
index a079b57b1..1084abde2 100644
--- a/e2fsprogs/e2p/ostype.c
+++ b/e2fsprogs/e2p/ostype.c
@@ -10,7 +10,7 @@
10#include "e2p.h" 10#include "e2p.h"
11#include <string.h> 11#include <string.h>
12 12
13const char *os_tab[] = 13static const char * const os_tab[] =
14 { "Linux", 14 { "Linux",
15 "Hurd", 15 "Hurd",
16 "Masix", 16 "Masix",
@@ -31,8 +31,7 @@ char *e2p_os2string(int os_type)
31 else 31 else
32 os = "(unknown os)"; 32 os = "(unknown os)";
33 33
34 ret = xmalloc(strlen(os)+1); 34 ret = bb_xstrdup(os);
35 strcpy(ret, os);
36 return ret; 35 return ret;
37} 36}
38 37
@@ -41,7 +40,7 @@ char *e2p_os2string(int os_type)
41 */ 40 */
42int e2p_string2os(char *str) 41int e2p_string2os(char *str)
43{ 42{
44 const char **cpp; 43 const char * const *cpp;
45 int i = 0; 44 int i = 0;
46 45
47 for (cpp = os_tab; *cpp; cpp++, i++) { 46 for (cpp = os_tab; *cpp; cpp++, i++) {
diff --git a/e2fsprogs/e2p/pf.c b/e2fsprogs/e2p/pf.c
index d1a1c4caa..2194ac6bf 100644
--- a/e2fsprogs/e2p/pf.c
+++ b/e2fsprogs/e2p/pf.c
@@ -24,7 +24,7 @@ struct flags_name {
24 const char *long_name; 24 const char *long_name;
25}; 25};
26 26
27static struct flags_name flags_array[] = { 27static const struct flags_name flags_array[] = {
28 { EXT2_SECRM_FL, "s", "Secure_Deletion" }, 28 { EXT2_SECRM_FL, "s", "Secure_Deletion" },
29 { EXT2_UNRM_FL, "u" , "Undelete" }, 29 { EXT2_UNRM_FL, "u" , "Undelete" },
30 { EXT2_SYNC_FL, "S", "Synchronous_Updates" }, 30 { EXT2_SYNC_FL, "S", "Synchronous_Updates" },
@@ -50,7 +50,7 @@ static struct flags_name flags_array[] = {
50void print_flags (FILE * f, unsigned long flags, unsigned options) 50void print_flags (FILE * f, unsigned long flags, unsigned options)
51{ 51{
52 int long_opt = (options & PFOPT_LONG); 52 int long_opt = (options & PFOPT_LONG);
53 struct flags_name *fp; 53 const struct flags_name *fp;
54 int first = 1; 54 int first = 1;
55 55
56 for (fp = flags_array; fp->flag != 0; fp++) { 56 for (fp = flags_array; fp->flag != 0; fp++) {
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index 802d7fa86..b7e25d68a 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -116,7 +116,7 @@ struct fsck_instance {
116 * Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3 116 * Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
117 * pathames. 117 * pathames.
118 */ 118 */
119static const char *devfs_hier[] = { 119static const char * const devfs_hier[] = {
120 "host", "bus", "target", "lun", 0 120 "host", "bus", "target", "lun", 0
121}; 121};
122#endif 122#endif
@@ -125,7 +125,8 @@ static char *base_device(const char *device)
125{ 125{
126 char *str, *cp; 126 char *str, *cp;
127#ifdef CONFIG_FEATURE_DEVFS 127#ifdef CONFIG_FEATURE_DEVFS
128 const char **hier, *disk; 128 const char * const *hier;
129 const char *disk;
129 int len; 130 int len;
130#endif 131#endif
131 132
@@ -866,9 +867,9 @@ struct fs_type_compile {
866#define FS_TYPE_OPT 1 867#define FS_TYPE_OPT 1
867#define FS_TYPE_NEGOPT 2 868#define FS_TYPE_NEGOPT 2
868 869
869static const char *fs_type_syntax_error = 870static const char fs_type_syntax_error[] =
870N_("Either all or none of the filesystem types passed to -t must be prefixed\n" 871"Either all or none of the filesystem types passed to -t must be prefixed\n"
871 "with 'no' or '!'.\n"); 872 "with 'no' or '!'.";
872 873
873static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) 874static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp)
874{ 875{
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index 110c02654..ec3e4fd62 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -47,7 +47,7 @@
47#include <sys/timex.h> 47#include <sys/timex.h>
48#include "busybox.h" 48#include "busybox.h"
49 49
50static struct {int bit; char *name;} statlist[] = { 50static const struct {int bit; const char *name;} statlist[] = {
51 { STA_PLL, "PLL" }, 51 { STA_PLL, "PLL" },
52 { STA_PPSFREQ, "PPSFREQ" }, 52 { STA_PPSFREQ, "PPSFREQ" },
53 { STA_PPSTIME, "PPSTIME" }, 53 { STA_PPSTIME, "PPSTIME" },
@@ -63,7 +63,7 @@ static struct {int bit; char *name;} statlist[] = {
63 { STA_CLOCKERR, "CLOCKERR" }, 63 { STA_CLOCKERR, "CLOCKERR" },
64 { 0, NULL } }; 64 { 0, NULL } };
65 65
66static char *ret_code_descript[] = { 66static const char * const ret_code_descript[] = {
67 "clock synchronized", 67 "clock synchronized",
68 "insert leap second", 68 "insert leap second",
69 "delete leap second", 69 "delete leap second",
@@ -88,7 +88,7 @@ int main(int argc, char ** argv)
88 struct timex txc; 88 struct timex txc;
89 int quiet=0; 89 int quiet=0;
90 int c, i, ret, sep; 90 int c, i, ret, sep;
91 char *descript; 91 const char *descript;
92 txc.modes=0; 92 txc.modes=0;
93 for (;;) { 93 for (;;) {
94 c = getopt( argc, argv, "qo:f:p:t:"); 94 c = getopt( argc, argv, "qo:f:p:t:");
diff --git a/modutils/insmod.c b/modutils/insmod.c
index d1504d0ab..da149fe2b 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -3394,7 +3394,7 @@ static int obj_gpl_license(struct obj_file *f, const char **license)
3394 * linux/include/linux/module.h. Checking for leading "GPL" will not 3394 * linux/include/linux/module.h. Checking for leading "GPL" will not
3395 * work, somebody will use "GPL sucks, this is proprietary". 3395 * work, somebody will use "GPL sucks, this is proprietary".
3396 */ 3396 */
3397 static const char *gpl_licenses[] = { 3397 static const char * const gpl_licenses[] = {
3398 "GPL", 3398 "GPL",
3399 "GPL v2", 3399 "GPL v2",
3400 "GPL and additional rights", 3400 "GPL and additional rights",
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index 11ca3268e..842fa0351 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -889,7 +889,7 @@ fail:
889#define EDQUOT ENOSPC 889#define EDQUOT ENOSPC
890#endif 890#endif
891 891
892static struct { 892static const struct {
893 enum nfs_stat stat; 893 enum nfs_stat stat;
894 int errnum; 894 int errnum;
895} nfs_errtbl[] = { 895} nfs_errtbl[] = {
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index 5144de711..80716d9f0 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -58,14 +58,14 @@
58#define S_LEN 128 58#define S_LEN 128
59 59
60/* These are the defaults */ 60/* These are the defaults */
61static char defaultmap[]="/boot/System.map"; 61static const char defaultmap[]="/boot/System.map";
62static char defaultpro[]="/proc/profile"; 62static const char defaultpro[]="/proc/profile";
63 63
64int readprofile_main(int argc, char **argv) 64int readprofile_main(int argc, char **argv)
65{ 65{
66 FILE *map; 66 FILE *map;
67 int proFd; 67 int proFd;
68 char *mapFile, *proFile, *mult=0; 68 const char *mapFile, *proFile, *mult=0;
69 unsigned long len=0, indx=1; 69 unsigned long len=0, indx=1;
70 unsigned long long add0=0; 70 unsigned long long add0=0;
71 unsigned int step; 71 unsigned int step;