[syslinux] [PATCH 11/23] com32/chain: mangle and related updates

Shao Miller sha0.miller at gmail.com
Thu Nov 8 08:11:05 PST 2012


On 11/5/2012 19:32, Michal Soltys wrote:
> Comments, output and minor adjustments.
>
> Signed-off-by: Michal Soltys <soltys at ziu.info>
> ---
> diff --git a/com32/chain/options.c b/com32/chain/options.c
> index b831afa..d8c601c 100644
> --- a/com32/chain/options.c
> +++ b/com32/chain/options.c
> @@ -284,15 +284,15 @@ int opt_parse_args(int argc, char *argv[])
>   	} else if (!strcmp(argv[i], "noswap")) {
>   	    opt.swap = false;
>   	} else if (!strcmp(argv[i], "nohide")) {
> -	    opt.hide = 0;
> +	    opt.hide = 0; /* bit 0 means disabled */
>   	} else if (!strcmp(argv[i], "hide")) {
>   	    opt.hide = 1; /* 001b */
>   	} else if (!strcmp(argv[i], "hideall")) {
> -	    opt.hide = 2; /* 010b */
> +	    opt.hide = 3; /* 011b */
>   	} else if (!strcmp(argv[i], "unhide")) {
>   	    opt.hide = 5; /* 101b */
>   	} else if (!strcmp(argv[i], "unhideall")) {
> -	    opt.hide = 6; /* 110b */
> +	    opt.hide = 7; /* 111b */
>   	} else if (!strcmp(argv[i], "setbpb")) {
>   	    opt.setbpb = true;
>   	} else if (!strcmp(argv[i], "nosetbpb")) {

Here's another place where identifiers (an 'enum' or macros) could 
potentially help.  Then, in 'manglepe_hide', instead of:

   if (!(opt.hide & 1))
...
   if (miter->index > 4 && !(opt.hide & 2))

you could have the more informative:

   if (!(opt.hide & HIDE_YES))
...
   if (miter->index > 4 && !(opt.hide & HIDE_ALL))

- Shao Miller



More information about the Syslinux mailing list