move struct option to .rodata

It does not make sense to have writable large arrays of "struct
option" on the stack.

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2011-03-03 15:00:30 +01:00
parent 63e6a3c82a
commit 6c7d5ae9a2
19 changed files with 20 additions and 19 deletions

View File

@ -457,7 +457,7 @@ main(int argc, char **argv) {
const char *opt_uuid = NULL;
uuid_t uuid_dat;
#endif
struct option longopts[] = {
static const struct option longopts[] = {
{ "check", no_argument, 0, 'c' },
{ "force", no_argument, 0, 'f' },
{ "pagesize", required_argument, 0, 'p' },

View File

@ -176,7 +176,7 @@ int main(int argc, char *argv[])
char *uuid = NULL, *label = NULL, *devname;
int c, rc = -1;
struct option longopts[] = {
static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
{ "label", 1, 0, 'L' },
{ "uuid", 1, 0, 'U' },

View File

@ -313,7 +313,7 @@ int main(int argc, char *argv[])
char *buf, *mask = NULL, *range = NULL;
int ncpus = 2048, rc, c;
struct option longopts[] = {
static const struct option longopts[] = {
{ "ncpus", 1, 0, 'n' },
{ "mask", 1, 0, 'm' },
{ "range", 1, 0, 'r' },

View File

@ -568,7 +568,7 @@ int main(int argc, char *argv[])
/* table.h */
struct tt *tt = NULL;
struct option longopts[] = {
static const struct option longopts[] = {
{ "ascii", 0, 0, 'a' },
{ "canonicalize", 0, 0, 'c' },
{ "direction", 1, 0, 'd' },

View File

@ -890,7 +890,7 @@ int main(int argc, char *argv[])
int tt_flags = TT_FL_TREE;
int i, c, status = EXIT_FAILURE;
struct option longopts[] = {
static const struct option longopts[] = {
{ "all", 0, 0, 'a' },
{ "bytes", 0, 0, 'b' },
{ "nodeps", 0, 0, 'd' },

View File

@ -439,7 +439,7 @@ usage(int rc)
exit(rc);
}
struct option longopts[] =
static const struct option longopts[] =
{
{ "help", 0, 0, 'h' },
{ "mountpoints",0, 0, 'x' },

View File

@ -323,7 +323,7 @@ main(int argc, char **argv)
int c, all = 0, has_offset = 0, noact = 0, mode = 0;
const char *fname;
struct option longopts[] = {
static const struct option longopts[] = {
{ "all", 0, 0, 'a' },
{ "help", 0, 0, 'h' },
{ "no-act", 0, 0, 'n' },

View File

@ -1042,7 +1042,8 @@ main(int argc, char **argv) {
int ro = 0;
int pfd = -1;
uintmax_t off = 0, slimit = 0;
struct option longopts[] = {
static const struct option longopts[] = {
{ "all", 0, 0, 'a' },
{ "set-capacity", 0, 0, 'c' },
{ "detach", 0, 0, 'd' },

View File

@ -189,7 +189,7 @@ int main(int argc, char *argv[])
struct sched_param sp;
pid_t pid = -1;
struct option longopts[] = {
static const struct option longopts[] = {
{ "batch", 0, NULL, 'b' },
{ "fifo", 0, NULL, 'f' },
{ "idle", 0, NULL, 'i' },

View File

@ -70,7 +70,7 @@ int main(int argc, char *argv[])
unsigned int ncpus;
size_t new_setsize, cur_setsize, cur_nbits, buflen;
struct option longopts[] = {
static const struct option longopts[] = {
{ "pid", 0, NULL, 'p' },
{ "cpu-list", 0, NULL, 'c' },
{ "help", 0, NULL, 'h' },

View File

@ -207,7 +207,7 @@ int main(int argc, char **argv)
char *types = NULL;
unsigned long oper = 0;
struct option longopts[] = {
static const struct option longopts[] = {
{ "all", 0, 0, 'a' },
{ "fake", 0, 0, 'f' },
{ "fork", 0, 0, 'F' },

View File

@ -83,7 +83,7 @@ int main(int argc, char **argv)
loff_t length = -2LL;
loff_t offset = 0;
struct option longopts[] = {
static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
{ "keep-size", 0, 0, 'n' },
{ "offset", 1, 0, 'o' },

View File

@ -57,7 +57,7 @@ int main(int argc, char **argv)
char *path;
struct stat sb;
struct option longopts[] = {
static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
{ "freeze", 0, 0, 'f' },
{ "unfreeze", 0, 0, 'u' },

View File

@ -76,7 +76,7 @@ int main(int argc, char **argv)
struct fstrim_range range;
struct stat sb;
struct option longopts[] = {
static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
{ "offset", 1, 0, 'o' },
{ "length", 1, 0, 'l' },

View File

@ -925,7 +925,7 @@ int main(int argc, char *argv[])
struct lscpu_desc _desc, *desc = &_desc;
int parsable = 0, c, i, hex = 0;
struct option longopts[] = {
static const struct option longopts[] = {
{ "help", no_argument, 0, 'h' },
{ "parse", no_argument, 0, 'p' },
{ "sysroot", required_argument, 0, 's' },

View File

@ -84,7 +84,7 @@
/* Options --3gb and --4gb are for compatibitity with an old Debian setarch
implementation. */
struct option longopts[] =
static const struct option longopts[] =
{
{ "help", 0, 0, 'h' },
{ "verbose", 0, 0, 'v' },

View File

@ -70,7 +70,7 @@ static void usage(int status)
int main(int argc, char *argv[])
{
struct option longopts[] = {
static const struct option longopts[] = {
{ "help", no_argument, 0, 'h' },
{ "mount", no_argument, 0, 'm' },
{ "uts", no_argument, 0, 'u' },

View File

@ -156,7 +156,7 @@ main(int argc, char **argv) {
extern int optind;
int ch;
struct option longopts[] = {
static const struct option longopts[] = {
{ "append", no_argument, 0, 'a' },
{ "command", required_argument, 0, 'c' },
{ "return", no_argument, 0, 'e' },

View File

@ -90,7 +90,7 @@ wchar_t **list; /* array of pointers to records */
wchar_t default_separator[] = { '\t', ' ', 0 };
wchar_t *separator = default_separator; /* field separator for table option */
struct option longopts[] =
static const struct option longopts[] =
{
{ "help", 0, 0, 'h' },
{ "columns", 0, 0, 'c' },