X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=docs%2Fstyle-guide.txt;h=9eed7f125156d67e14f2fce405129a706d5a1a1a;hb=31c765081dc41f158786545fbea9294be4685bd2;hp=fdf6cfe4daa2f0875a59aca48247cae3a7524e05;hpb=00ddd44cdad8142c6bb836efbfde9f38fa31b899;p=oweals%2Fbusybox.git diff --git a/docs/style-guide.txt b/docs/style-guide.txt index fdf6cfe4d..9eed7f125 100644 --- a/docs/style-guide.txt +++ b/docs/style-guide.txt @@ -329,7 +329,7 @@ With "const int" compiler may fail to optimize it out and will reserve a real storage in rodata for it! (Hopefully, newer gcc will get better at it...). With "define", you have slight risk of polluting namespace (#define doesn't allow you to redefine the name in the inner scopes), -and complex "define" are evaluated each time they uesd, not once +and complex "define" are evaluated each time they used, not once at declarations like enums. Also, the preprocessor does _no_ type checking whatsoever, making it much more error prone. @@ -679,11 +679,10 @@ line in the midst of your #includes, if you need to parse long options: Then have long options defined: - static const struct option _long_options[] = { - { "list", 0, NULL, 't' }, - { "extract", 0, NULL, 'x' }, - { NULL, 0, NULL, 0 } - }; + static const char _longopts[] ALIGN1 = + "list\0" No_argument "t" + "extract\0" No_argument "x" + ; And a code block similar to the following near the top of your applet_main() routine: @@ -691,7 +690,7 @@ routine: char *str_b; opt_complementary = "cryptic_string"; - applet_long_options = _long_options; /* if you have them */ + applet_long_options = _longopts; /* if you have them */ opt = getopt32(argc, argv, "ab:c", &str_b); if (opt & 1) { handle_option_a();