src/dpdk/lib/librte_eal/common/eal_common_dev.c
static int
build_devargs(const char *busname, const char *devname,
	      const char *drvargs, char **devargs)
{
	int length;

	length = snprintf(NULL, 0, "%s:%s,%s", busname, devname, drvargs);
	if (length < 0)
		return -EINVAL;

	*devargs = malloc(length + 1);
	if (*devargs == NULL)
		return -ENOMEM;

	length = snprintf(*devargs, length + 1, "%s:%s,%s",
			busname, devname, drvargs);
	if (length < 0) {
		free(*devargs);
		return -EINVAL;
	}

	return 0;
}
/* helper function to build devargs, caller should free the memory */
helper function to build devargs, caller should free the memory
helper function to build devargs caller should free the memory
static int
build_devargs(const char *busname, const char *devname,
	      const char *drvargs, char **devargs)
{
	int length;
	length = snprintf(NULL, 0, "%s:%s,%s", busname, devname, drvargs);
	if (length < 0)
		return -EINVAL;
	*devargs = malloc(length + 1);
	if (*devargs == NULL)
		return -ENOMEM;
	length = snprintf(*devargs, length + 1, "%s:%s,%s",
			busname, devname, drvargs);
	if (length < 0) {
		free(*devargs);
		return -EINVAL;
	}
	return 0;
}
static int build_devargs ( const char * busname , const char * devname , const char * drvargs , char * * devargs ) { int length ; length = snprintf ( NULL , 0 , " " , busname , devname , drvargs ) ; if ( length < 0 ) return - EINVAL ; * devargs = malloc ( length + 1 ) ; if ( * devargs == NULL ) return - ENOMEM ; length = snprintf ( * devargs , length + 1 , " " , busname , devname , drvargs ) ; if ( length < 0 ) { free ( * devargs ) ; return - EINVAL ; } return 0 ; }
helper function to build devargs, caller should free the memory
helper function to build devargs caller should free the memory