futility/updater_archive.c
/*
 * Adds and copies one new model config to the existing list of given manifest.
 * Returns a pointer to the newly allocated config, or NULL on failure.
 */
Adds and copies one new model config to the existing list of given manifest.
Returns a pointer to the newly allocated config, or NULL on failure.
Adds and copies one new model config to the existing list of given manifest . Returns a pointer to the newly allocated config or NULL on failure .
static struct model_config *manifest_add_model(
		struct manifest *manifest,
		const struct model_config *cfg)
{
	struct model_config *model;
	manifest->num++;
	manifest->models = (struct model_config *)realloc(
			manifest->models, manifest->num * sizeof(*model));
	if (!manifest->models) {
		ERROR("Internal error: failed to allocate buffer.\n");
		return NULL;
	}
	model = &manifest->models[manifest->num - 1];
	memcpy(model, cfg, sizeof(*model));
	return model;
}
static struct model_config * manifest_add_model ( struct manifest * manifest , const struct model_config * cfg ) { struct model_config * model ; manifest -> num ++ ; manifest -> models = ( struct model_config * ) realloc ( manifest -> models , manifest -> num * sizeof ( * model ) ) ; if ( ! manifest -> models ) { ERROR ( " \n " ) ; return NULL ; } model = & manifest -> models [ manifest -> num - 1 ] ; memcpy ( model , cfg , sizeof ( * model ) ) ; return model ; }
Adds and copies one new model config to the existing list of given manifest.
Adds and copies one new model config to the existing list of given manifest .