Re: [PATCH 2/6] Change semantics of interpolate to work like snprintf.

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

 



Pierre Habouzit <madcoder@xxxxxxxxxx> writes:

> @@ -89,14 +86,13 @@ unsigned long interpolate(char *result, unsigned long reslen,
>  			}
>  		}
>  		/* Straight copy one non-interpolation character. */
> +		if (newlen < reslen)
>  			*dest++ = *src;
>  		src++;
>  		newlen++;
>  	}
>  
> +	if (reslen > 0)
> +		*dest = '\0';
> +	return newlen;
>  }

Are you sure about this *dest = '\0' assignment?  Shouldn't it
be done only when "(newlen < reslen)" just like the straight
copy and substitution cases?

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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux