aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs
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 /e2fsprogs
parent0fa9deda1706b19e5f42ed392483a582880aaca3 (diff)
downloadbusybox-1f0262bcdb352e9a75a4e5f48cd63d05714e2859.tar.gz
another more const
Diffstat (limited to 'e2fsprogs')
-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
6 files changed, 22 insertions, 24 deletions
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 {
const char *string;
};
-static struct feature feature_list[] = {
+static const struct feature feature_list[] = {
{ E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_DIR_PREALLOC,
"dir_prealloc" },
{ E2P_FEATURE_COMPAT, EXT3_FEATURE_COMPAT_HAS_JOURNAL,
@@ -56,7 +56,7 @@ static struct feature feature_list[] = {
const char *e2p_feature2string(int compat, unsigned int mask)
{
- struct feature *f;
+ const struct feature *f;
static char buf[20];
char fchar;
int fnum;
@@ -87,7 +87,7 @@ const char *e2p_feature2string(int compat, unsigned int mask)
int e2p_string2feature(char *string, int *compat_type, unsigned int *mask)
{
- struct feature *f;
+ const struct feature *f;
char *eptr;
int num;
@@ -154,8 +154,7 @@ int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array)
unsigned int mask;
int compat_type;
- buf = xmalloc(strlen(str)+1);
- strcpy(buf, str);
+ buf = bb_xstrdup(str);
cp = buf;
while (cp && *cp) {
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 {
const char *string;
};
-static struct hash hash_list[] = {
+static const struct hash hash_list[] = {
{ EXT2_HASH_LEGACY, "legacy" },
{ EXT2_HASH_HALF_MD4, "half_md4" },
{ EXT2_HASH_TEA, "tea" },
@@ -30,7 +30,7 @@ static struct hash hash_list[] = {
const char *e2p_hash2string(int num)
{
- struct hash *p;
+ const struct hash *p;
static char buf[20];
for (p = hash_list; p->string; p++) {
@@ -46,7 +46,7 @@ const char *e2p_hash2string(int num)
*/
int e2p_string2hash(char *string)
{
- struct hash *p;
+ const struct hash *p;
char *eptr;
int num;
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 {
const char *string;
};
-static struct mntopt mntopt_list[] = {
+static const struct mntopt mntopt_list[] = {
{ EXT2_DEFM_DEBUG, "debug" },
{ EXT2_DEFM_BSDGROUPS, "bsdgroups" },
{ EXT2_DEFM_XATTR_USER, "user_xattr" },
@@ -35,7 +35,7 @@ static struct mntopt mntopt_list[] = {
const char *e2p_mntopt2string(unsigned int mask)
{
- struct mntopt *f;
+ const struct mntopt *f;
static char buf[20];
int fnum;
@@ -50,7 +50,7 @@ const char *e2p_mntopt2string(unsigned int mask)
int e2p_string2mntopt(char *string, unsigned int *mask)
{
- struct mntopt *f;
+ const struct mntopt *f;
char *eptr;
int num;
@@ -99,8 +99,7 @@ int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok)
int neg;
unsigned int mask;
- buf = xmalloc(strlen(str)+1);
- strcpy(buf, str);
+ buf = bb_xstrdup(str);
cp = buf;
while (cp && *cp) {
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 @@
#include "e2p.h"
#include <string.h>
-const char *os_tab[] =
+static const char * const os_tab[] =
{ "Linux",
"Hurd",
"Masix",
@@ -31,8 +31,7 @@ char *e2p_os2string(int os_type)
else
os = "(unknown os)";
- ret = xmalloc(strlen(os)+1);
- strcpy(ret, os);
+ ret = bb_xstrdup(os);
return ret;
}
@@ -41,7 +40,7 @@ char *e2p_os2string(int os_type)
*/
int e2p_string2os(char *str)
{
- const char **cpp;
+ const char * const *cpp;
int i = 0;
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 {
const char *long_name;
};
-static struct flags_name flags_array[] = {
+static const struct flags_name flags_array[] = {
{ EXT2_SECRM_FL, "s", "Secure_Deletion" },
{ EXT2_UNRM_FL, "u" , "Undelete" },
{ EXT2_SYNC_FL, "S", "Synchronous_Updates" },
@@ -50,7 +50,7 @@ static struct flags_name flags_array[] = {
void print_flags (FILE * f, unsigned long flags, unsigned options)
{
int long_opt = (options & PFOPT_LONG);
- struct flags_name *fp;
+ const struct flags_name *fp;
int first = 1;
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 {
* Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
* pathames.
*/
-static const char *devfs_hier[] = {
+static const char * const devfs_hier[] = {
"host", "bus", "target", "lun", 0
};
#endif
@@ -125,7 +125,8 @@ static char *base_device(const char *device)
{
char *str, *cp;
#ifdef CONFIG_FEATURE_DEVFS
- const char **hier, *disk;
+ const char * const *hier;
+ const char *disk;
int len;
#endif
@@ -866,9 +867,9 @@ struct fs_type_compile {
#define FS_TYPE_OPT 1
#define FS_TYPE_NEGOPT 2
-static const char *fs_type_syntax_error =
-N_("Either all or none of the filesystem types passed to -t must be prefixed\n"
- "with 'no' or '!'.\n");
+static const char fs_type_syntax_error[] =
+"Either all or none of the filesystem types passed to -t must be prefixed\n"
+ "with 'no' or '!'.";
static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp)
{