Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 2011 22:15:18 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228972 - head/lib/libc/gen
Message-ID:  <201112292215.pBTMFIxD075499@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Thu Dec 29 22:15:18 2011
New Revision: 228972
URL: http://svn.freebsd.org/changeset/base/228972

Log:
  libc: Eliminate some relative relocations in file flags table.

Modified:
  head/lib/libc/gen/strtofflags.c

Modified: head/lib/libc/gen/strtofflags.c
==============================================================================
--- head/lib/libc/gen/strtofflags.c	Thu Dec 29 21:17:35 2011	(r228971)
+++ head/lib/libc/gen/strtofflags.c	Thu Dec 29 22:15:18 2011	(r228972)
@@ -41,35 +41,35 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <unistd.h>
 
+#define longestflaglen	12
 static struct {
-	char *name;
+	char name[longestflaglen + 1];
+	char invert;
 	u_long flag;
-	int invert;
-} mapping[] = {
+} const mapping[] = {
 	/* shorter names per flag first, all prefixed by "no" */
-	{ "nosappnd",		SF_APPEND,	0 },
-	{ "nosappend",		SF_APPEND,	0 },
-	{ "noarch",		SF_ARCHIVED,	0 },
-	{ "noarchived",		SF_ARCHIVED,	0 },
-	{ "noschg",		SF_IMMUTABLE,	0 },
-	{ "noschange",		SF_IMMUTABLE,	0 },
-	{ "nosimmutable",	SF_IMMUTABLE,	0 },
-	{ "nosunlnk",		SF_NOUNLINK,	0 },
-	{ "nosunlink",		SF_NOUNLINK,	0 },
+	{ "nosappnd",		0, SF_APPEND	},
+	{ "nosappend",		0, SF_APPEND	},
+	{ "noarch",		0, SF_ARCHIVED	},
+	{ "noarchived",		0, SF_ARCHIVED	},
+	{ "noschg",		0, SF_IMMUTABLE	},
+	{ "noschange",		0, SF_IMMUTABLE	},
+	{ "nosimmutable",	0, SF_IMMUTABLE	},
+	{ "nosunlnk",		0, SF_NOUNLINK	},
+	{ "nosunlink",		0, SF_NOUNLINK	},
 #ifdef SF_SNAPSHOT
-	{ "nosnapshot",		SF_SNAPSHOT,	0 },
+	{ "nosnapshot",		0, SF_SNAPSHOT	},
 #endif
-	{ "nouappnd",		UF_APPEND,	0 },
-	{ "nouappend",		UF_APPEND,	0 },
-	{ "nouchg",		UF_IMMUTABLE,	0 },
-	{ "nouchange",		UF_IMMUTABLE,	0 },
-	{ "nouimmutable",	UF_IMMUTABLE,	0 },
-	{ "nodump",		UF_NODUMP,	1 },
-	{ "noopaque",		UF_OPAQUE,	0 },
-	{ "nouunlnk",		UF_NOUNLINK,	0 },
-	{ "nouunlink",		UF_NOUNLINK,	0 }
+	{ "nouappnd",		0, UF_APPEND	},
+	{ "nouappend",		0, UF_APPEND	},
+	{ "nouchg",		0, UF_IMMUTABLE	},
+	{ "nouchange",		0, UF_IMMUTABLE	},
+	{ "nouimmutable",	0, UF_IMMUTABLE	},
+	{ "nodump",		1, UF_NODUMP	},
+	{ "noopaque",		0, UF_OPAQUE	},
+	{ "nouunlnk",		0, UF_NOUNLINK	},
+	{ "nouunlink",		0, UF_NOUNLINK	}
 };
-#define longestflaglen	12
 #define nmappings	(sizeof(mapping) / sizeof(mapping[0]))
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112292215.pBTMFIxD075499>