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,
const char *e2p_feature2string(int compat, unsigned int mask)
{
- struct feature *f;
+ const struct feature *f;
static char buf[20];
- char fchar;
- int fnum;
+ char fchar;
+ int fnum;
for (f = feature_list; f->string; f++) {
if ((compat == f->compat) &&
return f->string;
}
switch (compat) {
- case E2P_FEATURE_COMPAT:
+ case E2P_FEATURE_COMPAT:
fchar = 'C';
break;
case E2P_FEATURE_INCOMPAT:
break;
}
for (fnum = 0; mask >>= 1; fnum++);
- sprintf(buf, "FEATURE_%c%d", fchar, fnum);
+ sprintf(buf, "FEATURE_%c%d", fchar, fnum);
return buf;
}
int e2p_string2feature(char *string, int *compat_type, unsigned int *mask)
{
- struct feature *f;
- char *eptr;
- int num;
+ const struct feature *f;
+ char *eptr;
+ int num;
for (f = feature_list; f->string; f++) {
if (!strcasecmp(string, f->string)) {
return 0;
}
-static char *skip_over_blanks(char *cp)
+static inline char *skip_over_blanks(char *cp)
{
while (*cp && isspace(*cp))
cp++;
return cp;
}
-static char *skip_over_word(char *cp)
+static inline char *skip_over_word(char *cp)
{
while (*cp && !isspace(*cp) && *cp != ',')
cp++;
unsigned int mask;
int compat_type;
- buf = malloc(strlen(str)+1);
- if (!buf)
- return 1;
- strcpy(buf, str);
+ buf = bb_xstrdup(str);
cp = buf;
while (cp && *cp) {
neg = 0;
}
return 0;
}
-