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

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

 



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¨îUCCESS [Arnold 02-08-23] SSFDC ´ú¤£¯à¨îUCCESS
> +	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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux