[PATCH 1/4] staging: keucr: Use strncmp() instead of custom StringCmp() and some style cleanups

Dan Carpenter error27 at gmail.com
Fri Dec 31 10:09:52 UTC 2010


On Fri, Dec 31, 2010 at 10:19:21AM +0100, Javier Martinez Canillas wrote:
>  //----- Check_D_CISdata() ----------------------------------------------
>  int Check_D_CISdata(BYTE *buf, BYTE *redundant)
>  {
> -    BYTE cis[]={0x01,0x03,0xD9,0x01,0xFF,0x18,0x02,0xDF,0x01,0x20};
> +	BYTE cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02,
> +		      0xDF, 0x01, 0x20};
>  
> -    if (!IsSSFDCCompliance && !IsXDCompliance)
> -        return(SUCCESS);             // ¥Ø«e¬°±j¨î SUCCESS [Arnold 02-08-23] SSFDC ´ú¸Õ, ¤£¯à±j¨î SUCCESS
> +	if (!IsSSFDCCompliance && !IsXDCompliance)
> +		return SUCCESS;
>  
> -    if (!StringCmp((char *)(redundant+0x0D),(char *)EccBuf,3))
> -        return(StringCmp((char *)buf,(char *)cis,10));
> +	if (!strncmp((char *)(redundant+0x0D), (char *)EccBuf, 3))
> +		return strncmp((char *)buf, (char *)cis, 10);


"cis" isn't a string.  I suspect none of these are.  Use memcmp()
instead of strncmp().  With memcmp() you can get rid of the cast.  Also
use sizeof(cis) instead of hardcoding it to 10.

Eventually we should also put all the 0x0D magic variables in defines as
well.

regards,
dan carpenter




More information about the devel mailing list