Re: [PATCH v4 1/4] libusbg: Path length replaced with MAX_LENGTH & MAX_PATH_LENGTH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 06, 2013 at 02:04:40PM +0100, Stanislaw Wadas wrote:
> 256 hard coded value has been replaced by two defined
> constants MAX_LENGTH and MAX_PATH_LENGTH

In both the patch summary and commit message, please remember to use
present tense as Alan pointed out. e.g.:

"
Subject: [PATCH v4 1/4" libusbg: replace array lengths with defines

Replace hard coded value of 256 by two constant defines,
MAX_PATH_LENGTH and MAX_STR_LENGTH.
"

> 
> Signed-off-by: Stanislaw Wadas <s.wadas@xxxxxxxxxxx>
> ---
> Changes since v1:
>         - fixed typos in MAX_LENGTH throughout
> 
>  include/gadget/gadget.h |   27 +++++++++++++++------------
>  src/gadget.c            |   46 +++++++++++++++++++++++-----------------------
>  2 files changed, 38 insertions(+), 35 deletions(-)
> 
> diff --git a/include/gadget/gadget.h b/include/gadget/gadget.h
> index 6a32c39..9bca97e 100644
> --- a/include/gadget/gadget.h
> +++ b/include/gadget/gadget.h
> @@ -33,13 +33,16 @@
>  #define DEFAULT_UDC		NULL
>  #define LANG_US_ENG		0x0409
>  
> +#define MAX_LENGTH 256
> +#define MAX_PATH_LENGTH 256
> +
>  /**
>   * @struct state
>   * @brief State of the gadget devices in the system
>   */
>  struct state
>  {
> -	char path[256];
> +	char path[MAX_PATH_LENGTH];
>  
>  	TAILQ_HEAD(ghead, gadget) gadgets;
>  };
> @@ -51,8 +54,8 @@ struct state
>  struct gadget
>  {
>  	char name[40];
> -	char path[256];
> -	char udc[256];
> +	char path[MAX_PATH_LENGTH];
> +	char udc[MAX_LENGTH];

As David is suggesting, MAX_LENGTH needs a better name. I'm fine with
MAX_PATH_LENGTH. s/MAX_LENGTH/MAX_STR_LENGTH/ would be much better.

-Matt

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux