svn commit: trunk/busybox: coreutils e2fsprogs e2fsprogs/e2p miscut etc...

vodz at busybox.net vodz at busybox.net
Thu Oct 20 11:17:52 UTC 2005


Author: vodz
Date: 2005-10-20 04:17:48 -0700 (Thu, 20 Oct 2005)
New Revision: 11897

Log:
another more const

Modified:
   trunk/busybox/coreutils/ls.c
   trunk/busybox/coreutils/stat.c
   trunk/busybox/e2fsprogs/e2p/feature.c
   trunk/busybox/e2fsprogs/e2p/hashstr.c
   trunk/busybox/e2fsprogs/e2p/mntopts.c
   trunk/busybox/e2fsprogs/e2p/ostype.c
   trunk/busybox/e2fsprogs/e2p/pf.c
   trunk/busybox/e2fsprogs/fsck.c
   trunk/busybox/miscutils/adjtimex.c
   trunk/busybox/modutils/insmod.c
   trunk/busybox/util-linux/nfsmount.c
   trunk/busybox/util-linux/readprofile.c


Changeset:
Modified: trunk/busybox/coreutils/ls.c
===================================================================
--- trunk/busybox/coreutils/ls.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/coreutils/ls.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -170,7 +170,7 @@
 
 /* long option entry used only for --color, which has no short option
  * equivalent.  */
-static struct option ls_color_opt[] =
+static const struct option ls_color_opt[] =
 {
 	{"color", optional_argument, NULL, 1},
         {NULL, 0, NULL, 0}

Modified: trunk/busybox/coreutils/stat.c
===================================================================
--- trunk/busybox/coreutils/stat.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/coreutils/stat.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -81,9 +81,9 @@
 static char const *human_fstype(long f_type)
 {
 	int i;
-	static struct types {
+	static const struct types {
 		long type;
-		char *fs;
+		const char *fs;
 	} humantypes[] = {
 		{ 0xADFF,     "affs" },
 		{ 0x1Cd1,     "devpts" },

Modified: trunk/busybox/e2fsprogs/e2p/feature.c
===================================================================
--- trunk/busybox/e2fsprogs/e2p/feature.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/e2fsprogs/e2p/feature.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -22,7 +22,7 @@
 	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 @@
 
 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 @@
 
 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 @@
 	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;

Modified: trunk/busybox/e2fsprogs/e2p/hashstr.c
===================================================================
--- trunk/busybox/e2fsprogs/e2p/hashstr.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/e2fsprogs/e2p/hashstr.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -21,7 +21,7 @@
 	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 @@
 
 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 @@
  */
 int e2p_string2hash(char *string)
 {
-	struct hash *p;
+	const struct hash *p;
 	char *eptr;
 	int num;
 

Modified: trunk/busybox/e2fsprogs/e2p/mntopts.c
===================================================================
--- trunk/busybox/e2fsprogs/e2p/mntopts.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/e2fsprogs/e2p/mntopts.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -21,7 +21,7 @@
 	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 @@
 
 const char *e2p_mntopt2string(unsigned int mask)
 {
-	struct mntopt  *f;
+	const struct mntopt  *f;
 	static char buf[20];
 	int	fnum;
 
@@ -50,7 +50,7 @@
 
 int e2p_string2mntopt(char *string, unsigned int *mask)
 {
-	struct mntopt  *f;
+	const struct mntopt  *f;
 	char		*eptr;
 	int		num;
 
@@ -99,8 +99,7 @@
 	int	neg;
 	unsigned int	mask;
 
-	buf = xmalloc(strlen(str)+1);
-	strcpy(buf, str);
+	buf = bb_xstrdup(str);
 	cp = buf;
 	while (cp && *cp) {
 		neg = 0;

Modified: trunk/busybox/e2fsprogs/e2p/ostype.c
===================================================================
--- trunk/busybox/e2fsprogs/e2p/ostype.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/e2fsprogs/e2p/ostype.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -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 @@
 	else
 		os = "(unknown os)";
 
-	ret = xmalloc(strlen(os)+1);
-	strcpy(ret, os);
+	ret = bb_xstrdup(os);
 	return ret;
 }
 
@@ -41,7 +40,7 @@
  */
 int e2p_string2os(char *str)
 {
-	const char **cpp;
+	const char * const *cpp;
 	int i = 0;
 
 	for (cpp = os_tab; *cpp; cpp++, i++) {

Modified: trunk/busybox/e2fsprogs/e2p/pf.c
===================================================================
--- trunk/busybox/e2fsprogs/e2p/pf.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/e2fsprogs/e2p/pf.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -24,7 +24,7 @@
 	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 @@
 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++) {

Modified: trunk/busybox/e2fsprogs/fsck.c
===================================================================
--- trunk/busybox/e2fsprogs/fsck.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/e2fsprogs/fsck.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -116,7 +116,7 @@
  * 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 @@
 {
 	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 @@
 #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)
 {

Modified: trunk/busybox/miscutils/adjtimex.c
===================================================================
--- trunk/busybox/miscutils/adjtimex.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/miscutils/adjtimex.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -47,7 +47,7 @@
 #include <sys/timex.h>
 #include "busybox.h"
 
-static struct {int bit; char *name;} statlist[] = {
+static const struct {int bit; const char *name;} statlist[] = {
 	{ STA_PLL,       "PLL"       },
 	{ STA_PPSFREQ,   "PPSFREQ"   },
 	{ STA_PPSTIME,   "PPSTIME"   },
@@ -63,7 +63,7 @@
 	{ STA_CLOCKERR,  "CLOCKERR"  },
 	{ 0, NULL } };
 
-static char *ret_code_descript[] = {
+static const char * const ret_code_descript[] = {
 	"clock synchronized",
 	"insert leap second",
 	"delete leap second",
@@ -88,7 +88,7 @@
 	struct timex txc;
 	int quiet=0;
 	int c, i, ret, sep;
-	char *descript;
+	const char *descript;
 	txc.modes=0;
 	for (;;) {
 		c = getopt( argc, argv, "qo:f:p:t:");

Modified: trunk/busybox/modutils/insmod.c
===================================================================
--- trunk/busybox/modutils/insmod.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/modutils/insmod.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -3394,7 +3394,7 @@
 	 * linux/include/linux/module.h.  Checking for leading "GPL" will not
 	 * work, somebody will use "GPL sucks, this is proprietary".
 	 */
-	static const char *gpl_licenses[] = {
+	static const char * const gpl_licenses[] = {
 		"GPL",
 		"GPL v2",
 		"GPL and additional rights",

Modified: trunk/busybox/util-linux/nfsmount.c
===================================================================
--- trunk/busybox/util-linux/nfsmount.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/util-linux/nfsmount.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -889,7 +889,7 @@
 #define EDQUOT	ENOSPC
 #endif
 
-static struct {
+static const struct {
 	enum nfs_stat stat;
 	int errnum;
 } nfs_errtbl[] = {

Modified: trunk/busybox/util-linux/readprofile.c
===================================================================
--- trunk/busybox/util-linux/readprofile.c	2005-10-20 09:48:28 UTC (rev 11896)
+++ trunk/busybox/util-linux/readprofile.c	2005-10-20 11:17:48 UTC (rev 11897)
@@ -58,14 +58,14 @@
 #define S_LEN 128
 
 /* These are the defaults */
-static char defaultmap[]="/boot/System.map";
-static char defaultpro[]="/proc/profile";
+static const char defaultmap[]="/boot/System.map";
+static const char defaultpro[]="/proc/profile";
 
 int readprofile_main(int argc, char **argv)
 {
 	FILE *map;
 	int proFd;
-	char *mapFile, *proFile, *mult=0;
+	const char *mapFile, *proFile, *mult=0;
 	unsigned long len=0, indx=1;
 	unsigned long long add0=0;
 	unsigned int step;




More information about the busybox-cvs mailing list