On Thu, Jul 10, 2008 at 01:30:04PM +0200, Jean Delvare wrote: > Subject: partitions: Prefer strlcpy() over snprintf() > > strlcpy is faster than snprintf when you don't use the returned value. > if (!part) > - snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name); > + strlcpy(buf, hd->disk_name, BDEVNAME_SIZE); > else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) > snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, part); > else Yecch. There is a parallelism between the two cases which makes the source nice and readable. You want to destroy the parallelism for no gain. Different functions, different parameter order. Ach. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html