• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ prop_object_release函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中prop_object_release函数的典型用法代码示例。如果您正苦于以下问题:C++ prop_object_release函数的具体用法?C++ prop_object_release怎么用?C++ prop_object_release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了prop_object_release函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: fd_set_properties

static void
fd_set_properties(struct fd_softc *fd)
{
	prop_dictionary_t disk_info, odisk_info, geom;
	const struct fd_type *fdt;
	int secsize;

	fdt = fd->sc_type;
	if (fdt == NULL) {
		fdt = fd->sc_deftype;
		if (fdt == NULL)
			return;
	}

	disk_info = prop_dictionary_create();

	geom = prop_dictionary_create();

	prop_dictionary_set_uint64(geom, "sectors-per-unit",
	    fdt->size);

	switch (fdt->secsize) {
	case 2:
		secsize = 512;
		break;
	case 3:
		secsize = 1024;
		break;
	default:
		secsize = 0;
	}

	prop_dictionary_set_uint32(geom, "sector-size",
	    secsize);

	prop_dictionary_set_uint16(geom, "sectors-per-track",
	    fdt->sectrac);

	prop_dictionary_set_uint16(geom, "tracks-per-cylinder",
	    fdt->heads);

	prop_dictionary_set_uint64(geom, "cylinders-per-unit",
	    fdt->cyls);

	prop_dictionary_set(disk_info, "geometry", geom);
	prop_object_release(geom);

	prop_dictionary_set(device_properties(fd->sc_dev),
	    "disk-info", disk_info);

	/*
	 * Don't release disk_info here; we keep a reference to it.
	 * disk_detach() will release it when we go away.
	 */

	odisk_info = fd->sc_dk.dk_info;
	fd->sc_dk.dk_info = disk_info;
	if (odisk_info)
		prop_object_release(odisk_info);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:60,代码来源:fd.c


示例2: show_pkg_info_from_metadir

int
show_pkg_info_from_metadir(struct xbps_handle *xhp,
			   const char *pkgname,
			   const char *option)
{
	prop_dictionary_t d, pkgdb_d;
	const char *instdate, *pname;
	bool autoinst;

	d = xbps_dictionary_from_metadata_plist(xhp, pkgname, XBPS_PKGPROPS);
	if (d == NULL)
		return EINVAL;

	prop_dictionary_get_cstring_nocopy(d, "pkgname", &pname);
	pkgdb_d = xbps_pkgdb_get_pkgd(xhp, pname, false);
	if (pkgdb_d == NULL) {
		prop_object_release(d);
		return EINVAL;
	}
	if (prop_dictionary_get_cstring_nocopy(pkgdb_d,
	    "install-date", &instdate))
		prop_dictionary_set_cstring_nocopy(d, "install-date",
		    instdate);

	if (prop_dictionary_get_bool(pkgdb_d, "automatic-install", &autoinst))
		prop_dictionary_set_bool(d, "automatic-install", autoinst);

	if (option == NULL)
		show_pkg_info(d);
	else
		show_pkg_info_one(d, option);

	prop_object_release(d);
	return 0;
}
开发者ID:xdave,项目名称:xbps,代码行数:35,代码来源:show-info-files.c


示例3: npfctl_remove_rule

int
npfctl_remove_rule(u_long cmd, void *data)
{
	struct plistref *pref = data;
	prop_dictionary_t dict, errdict;
	prop_object_t obj;
	const char *name;
	int error, numrules;

	/* Retrieve and construct the rule. */
	error = prop_dictionary_copyin_ioctl(pref, cmd, &dict);
	if (error) {
		return error;
	}

	/* Dictionary for error reporting. */
	errdict = prop_dictionary_create();

	obj = prop_dictionary_get(dict, "name");
	name = prop_string_cstring_nocopy(obj);
	npf_rule_t *rl;
	error = npf_mk_singlerule(dict, prop_array_create(), &rl, errdict);

	npf_core_enter();
	numrules = npf_named_ruleset_remove(name, npf_core_ruleset(), rl);
	npf_core_exit();
	prop_object_release(dict);

	/* Error report. */
	prop_dictionary_set_int32(errdict, "errno", error);
	prop_dictionary_set_int32(errdict, "numrules", numrules);
	prop_dictionary_copyout_ioctl(pref, cmd, errdict);
	prop_object_release(errdict);
	return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:35,代码来源:npf_ctl.c


示例4: _prop_array_internalize_continue

static bool
_prop_array_internalize_continue(prop_stack_t stack,
    prop_object_t *obj,
    struct _prop_object_internalize_context *ctx,
    void *data, prop_object_t child)
{
	prop_array_t array;

	_PROP_ASSERT(data == NULL);

	if (child == NULL)
		goto bad; /* Element could not be parsed. */

	array = *obj;

	if (prop_array_add(array, child) == false) {
		prop_object_release(child);
		goto bad;
	}
	prop_object_release(child);

	/*
	 * Current element is processed and added, look for next.
	 */
	return (_prop_array_internalize_body(stack, obj, ctx));

 bad:
	prop_object_release(*obj);
	*obj = NULL;
	return (true);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:31,代码来源:prop_array.c


示例5: hdaudioctl_list

static int
hdaudioctl_list(int fd)
{
	prop_dictionary_t request, response;
	prop_dictionary_t dict;
	prop_object_iterator_t iter;
	prop_object_t obj;
	prop_array_t array;
	uint16_t nid, codecid;
	uint16_t vendor, product;
	uint32_t subsystem;
	const char *device = NULL;
	int error;

	request = prop_dictionary_create();
	if (request == NULL) {
		fprintf(stderr, "out of memory\n");
		return ENOMEM;
	}

	error = prop_dictionary_sendrecv_ioctl(request, fd,
	    HDAUDIO_FGRP_INFO, &response);
	if (error != 0) {
		perror("HDAUDIO_FGRP_INFO failed");
		return error;
	}

	array = prop_dictionary_get(response, "function-group-info");
	iter = prop_array_iterator(array);
	prop_object_iterator_reset(iter);
	while ((obj = prop_object_iterator_next(iter)) != NULL) {
		dict = (prop_dictionary_t)obj;
		prop_dictionary_get_uint16(dict, "codecid", &codecid);
		prop_dictionary_get_uint16(dict, "nid", &nid);
		prop_dictionary_get_uint16(dict, "vendor-id", &vendor);
		prop_dictionary_get_uint16(dict, "product-id", &product);
		prop_dictionary_get_uint32(dict, "subsystem-id", &subsystem);
		prop_dictionary_get_cstring_nocopy(dict, "device", &device);

		printf("codecid 0x%02X nid 0x%02X vendor 0x%04X "
		    "product 0x%04X subsystem 0x%08X device %s\n",
		    codecid, nid, vendor, product, subsystem,
		    device ? device : "<none>");
	}

	prop_object_release(array);
	prop_object_release(response);
	prop_object_release(request);

	return 0;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:51,代码来源:hdaudioctl.c


示例6: prop_object_iterator_release

/*
 * prop_object_iterator_release --
 *	Release the object iterator.
 */
void
prop_object_iterator_release(prop_object_iterator_t pi)
{

	prop_object_release(pi->pi_obj);
	_PROP_FREE(pi, M_TEMP);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:11,代码来源:prop_object.c


示例7: npfctl_sessions_save

/*
 * npfctl_sessions_save: construct a list of sessions and export for saving.
 */
int
npfctl_sessions_save(u_long cmd, void *data)
{
	struct plistref *pref = data;
	prop_dictionary_t sesdict;
	prop_array_t selist, nplist;
	int error;

	/* Create a dictionary and two lists. */
	sesdict = prop_dictionary_create();
	selist = prop_array_create();
	nplist = prop_array_create();

	/* Save the sessions. */
	error = npf_session_save(selist, nplist);
	if (error) {
		goto fail;
	}

	/* Set the session list, NAT policy list and export the dictionary. */
	prop_dictionary_set(sesdict, "session-list", selist);
	prop_dictionary_set(sesdict, "nat-policy-list", nplist);
	error = prop_dictionary_copyout_ioctl(pref, cmd, sesdict);
fail:
	prop_object_release(sesdict);
	return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:30,代码来源:npf_ctl.c


示例8: _prop_array_internalize_body

static bool
_prop_array_internalize_body(prop_stack_t stack, prop_object_t *obj,
    struct _prop_object_internalize_context *ctx)
{
	prop_array_t array = *obj;

	_PROP_ASSERT(array != NULL);

	/* Fetch the next tag. */
	if (_prop_object_internalize_find_tag(ctx, NULL,
				_PROP_TAG_TYPE_EITHER) == false)
		goto bad;

	/* Check to see if this is the end of the array. */
	if (_PROP_TAG_MATCH(ctx, "array") &&
	    ctx->poic_tag_type == _PROP_TAG_TYPE_END) {
		/* It is, so don't iterate any further. */
		return (true);
	}

	if (_prop_stack_push(stack, array,
			     _prop_array_internalize_continue, NULL, NULL))
		return (false);

 bad:
	prop_object_release(array);
	*obj = NULL;
	return (true);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:29,代码来源:prop_array.c


示例9: npfctl_sessions_load

/*
 * npfctl_sessions_load: import a list of sessions, reconstruct them and load.
 */
int
npfctl_sessions_load(u_long cmd, void *data)
{
	const struct plistref *pref = data;
	npf_sehash_t *sehasht = NULL;
	prop_dictionary_t sesdict, sedict;
	prop_object_iterator_t it;
	prop_array_t selist;
	int error;

	/* Retrieve the dictionary containing session and NAT policy lists. */
	error = prop_dictionary_copyin_ioctl(pref, cmd, &sesdict);
	if (error)
		return error;

	/*
	 * Note: session objects contain the references to the NAT policy
	 * entries.  Therefore, no need to directly access it.
	 */
	selist = prop_dictionary_get(sesdict, "session-list");
	if (prop_object_type(selist) != PROP_TYPE_ARRAY) {
		error = EINVAL;
		goto fail;
	}

	/* Create a session hash table. */
	sehasht = sess_htable_create();
	if (sehasht == NULL) {
		error = ENOMEM;
		goto fail;
	}

	/*
	 * Iterate through and construct each session.
	 */
	error = 0;
	it = prop_array_iterator(selist);
	npf_core_enter();
	while ((sedict = prop_object_iterator_next(it)) != NULL) {
		/* Session - dictionary. */
		if (prop_object_type(sedict) != PROP_TYPE_DICTIONARY) {
			error = EINVAL;
			goto fail;
		}
		/* Construct and insert real session structure. */
		error = npf_session_restore(sehasht, sedict);
		if (error) {
			goto fail;
		}
	}
	npf_core_exit();
	sess_htable_reload(sehasht);
fail:
	prop_object_release(selist);
	if (error && sehasht) {
		/* Destroy session table. */
		sess_htable_destroy(sehasht);
	}
	return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:63,代码来源:npf_ctl.c


示例10: prop_string_copy

/*
 * prop_string_copy --
 *	Copy a string.  If the original string is immutable, then the
 *	copy is also immutable and references the same external data.
 */
prop_string_t
prop_string_copy(prop_string_t ops)
{
	prop_string_t ps;

	if (! prop_object_is_string(ops))
		return (NULL);

	ps = _prop_string_alloc();
	if (ps != NULL) {
		ps->ps_size = ops->ps_size;
		ps->ps_flags = ops->ps_flags;
		if (ops->ps_flags & PS_F_NOCOPY)
			ps->ps_immutable = ops->ps_immutable;
		else {
			char *cp = _PROP_MALLOC(ps->ps_size + 1, M_PROP_STRING);
			if (cp == NULL) {
				prop_object_release(ps);
				return (NULL);
			}
			strcpy(cp, prop_string_contents(ops));
			ps->ps_mutable = cp;
		}
	}
	return (ps);
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:31,代码来源:prop_string.c


示例11: prop_array_remove

/*
 * prop_array_remove --
 *	Remove the reference to an object from an array at the specified
 *	index.	The array will be compacted following the removal.
 */
void
prop_array_remove(prop_array_t pa, unsigned int idx)
{
	prop_object_t po;

	if (! prop_object_is_array(pa))
		return;

	_PROP_RWLOCK_WRLOCK(pa->pa_rwlock);

	_PROP_ASSERT(idx < pa->pa_count);

	/* XXX Should this be a _PROP_ASSERT()? */
	if (prop_array_is_immutable(pa)) {
		_PROP_RWLOCK_UNLOCK(pa->pa_rwlock);
		return;
	}

	po = pa->pa_array[idx];
	_PROP_ASSERT(po != NULL);

	for (++idx; idx < pa->pa_count; idx++)
		pa->pa_array[idx - 1] = pa->pa_array[idx];
	pa->pa_count--;
	pa->pa_version++;

	_PROP_RWLOCK_UNLOCK(pa->pa_rwlock);

	prop_object_release(po);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:35,代码来源:prop_array.c


示例12: prop_dictionary_augment

prop_dictionary_t
prop_dictionary_augment(prop_dictionary_t bottom, prop_dictionary_t top)
{
	prop_object_iterator_t i;
	prop_dictionary_t d;
	prop_object_t ko, o;
	prop_dictionary_keysym_t k;
	const char *key;

	d = prop_dictionary_copy_mutable(bottom);

	i = prop_dictionary_iterator(top);

	while ((ko = prop_object_iterator_next(i)) != NULL) {
		k = (prop_dictionary_keysym_t)ko;
		key = prop_dictionary_keysym_cstring_nocopy(k);
		o = prop_dictionary_get_keysym(top, k);
		if (o == NULL || !prop_dictionary_set(d, key, o)) {
			prop_object_release((prop_object_t)d);
			d = NULL;
			break;
		}
	}
	prop_object_iterator_release(i);
	prop_dictionary_make_immutable(d);
	return d;
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:27,代码来源:env.c


示例13: main

int
main(int argc, char **argv)
{
	modctl_load_t cmdargs;
	prop_dictionary_t props;
	char *propsstr;
	int ch;
	int flags;

	flags = 0;
	props = prop_dictionary_create();

	while ((ch = getopt(argc, argv, "b:fi:s:")) != -1) {
		switch (ch) {
		case 'b':
			parse_param(props, optarg, parse_bool_param);
			break;

		case 'f':
			flags |= MODCTL_LOAD_FORCE;
			break;

		case 'i':
			parse_param(props, optarg, parse_int_param);
			break;

		case 's':
			parse_param(props, optarg, parse_string_param);
			break;

		default:
			usage();
			/* NOTREACHED */
		}
	}

	argc -= optind;
	argv += optind;
	if (argc != 1)
		usage();

	propsstr = prop_dictionary_externalize(props);
	if (propsstr == NULL)
		errx(EXIT_FAILURE, "Failed to process properties");

	cmdargs.ml_filename = argv[0];
	cmdargs.ml_flags = flags;
	cmdargs.ml_props = propsstr;
	cmdargs.ml_propslen = strlen(propsstr);

	if (modctl(MODCTL_LOAD, &cmdargs)) {
		err(EXIT_FAILURE, NULL);
	}

	free(propsstr);
	prop_object_release(props);

	exit(EXIT_SUCCESS);
}
开发者ID:durai145,项目名称:minix-pkgsrc,代码行数:59,代码来源:modload.c


示例14: dm_table_deps_ioctl

/*
 * Get list of physical devices for active table.
 * Get dev_t from pdev vnode and insert it into cmd_array.
 *
 * XXX. This function is called from lvm2tools to get information
 *      about physical devices, too e.g. during vgcreate.
 */
int
dm_table_deps_ioctl(prop_dictionary_t dm_dict)
{
	dm_dev_t *dmv;
	dm_table_t *tbl;
	dm_table_entry_t *table_en;

	prop_array_t cmd_array;
	const char *name, *uuid;
	uint32_t flags, minor;

	int table_type;

	name = NULL;
	uuid = NULL;
	dmv = NULL;
	flags = 0;

	prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_NAME, &name);
	prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_UUID, &uuid);
	prop_dictionary_get_uint32(dm_dict, DM_IOCTL_FLAGS, &flags);
	prop_dictionary_get_uint32(dm_dict, DM_IOCTL_MINOR, &minor);

	/* create array for dev_t's */
	cmd_array = prop_array_create();

	if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
		DM_REMOVE_FLAG(flags, DM_EXISTS_FLAG);
		return ENOENT;
	}
	prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
	prop_dictionary_set_cstring(dm_dict, DM_IOCTL_NAME, dmv->name);
	prop_dictionary_set_cstring(dm_dict, DM_IOCTL_UUID, dmv->uuid);

	aprint_debug("Getting table deps for device: %s\n", dmv->name);

	/*
	 * if DM_QUERY_INACTIVE_TABLE_FLAG is passed we need to query
	 * INACTIVE TABLE
	 */
	if (flags & DM_QUERY_INACTIVE_TABLE_FLAG)
		table_type = DM_TABLE_INACTIVE;
	else
		table_type = DM_TABLE_ACTIVE;

	tbl = dm_table_get_entry(&dmv->table_head, table_type);

	SLIST_FOREACH(table_en, tbl, next)
	    table_en->target->deps(table_en, cmd_array);

	dm_table_release(&dmv->table_head, table_type);
	dm_dev_unbusy(dmv);

	prop_dictionary_set(dm_dict, DM_IOCTL_CMD_DATA, cmd_array);
	prop_object_release(cmd_array);

	return 0;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:65,代码来源:dm_ioctl.c


示例15: hdaudioctl_set

static int
hdaudioctl_set(int fd, int argc, char *argv[])
{
	prop_dictionary_t request, response;
	prop_array_t config = NULL;
	uint16_t nid, codecid;
	int error;

	if (argc < 2 || argc > 3)
		usage();

	codecid = strtol(argv[0], NULL, 0);
	nid = strtol(argv[1], NULL, 0);
	if (argc == 3) {
		config = prop_array_internalize_from_file(argv[2]);
		if (config == NULL) {
			fprintf(stderr,
			    "couldn't load configuration from %s\n", argv[2]);
			return EIO;
		}
	}

	request = prop_dictionary_create();
	if (request == NULL) {
		fprintf(stderr, "out of memory\n");
		return ENOMEM;
	}

	prop_dictionary_set_uint16(request, "codecid", codecid);
	prop_dictionary_set_uint16(request, "nid", nid);
	if (config)
		prop_dictionary_set(request, "pin-config", config);

	error = prop_dictionary_sendrecv_ioctl(request, fd,
	    HDAUDIO_FGRP_SETCONFIG, &response);
	if (error != 0) {
		perror("HDAUDIO_FGRP_SETCONFIG failed");
		return error;
	}

	prop_object_release(response);
	prop_object_release(request);

	return 0;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:45,代码来源:hdaudioctl.c


示例16: npfctl_update_rule

/*
 * npfctl_update_rule: reload a specific rule identified by the name.
 */
int
npfctl_update_rule(u_long cmd, void *data)
{
	struct plistref *pref = data;
	prop_dictionary_t dict, errdict;
	prop_array_t subrules;
	prop_object_t obj;
	npf_ruleset_t *rlset;
	const char *name;
	int error;

	/* Retrieve and construct the rule. */
	error = prop_dictionary_copyin_ioctl(pref, cmd, &dict);
	if (error) {
		return error;
	}

	/* Dictionary for error reporting. */
	errdict = prop_dictionary_create();

	/* Create the ruleset and construct sub-rules. */
	rlset = npf_ruleset_create();
	subrules = prop_dictionary_get(dict, "subrules");
	error = npf_mk_subrules(rlset, subrules, NULL, errdict);
	if (error) {
		goto out;
	}

	/* Lookup the rule by name, and replace its subset (sub-rules). */
	obj = prop_dictionary_get(dict, "name");
	name = prop_string_cstring_nocopy(obj);
	if (npf_ruleset_replace(name, rlset) == NULL) {
		/* Not found. */
		error = ENOENT;
out:		/* Error path. */
		npf_ruleset_destroy(rlset);
	}
	prop_object_release(dict);

	/* Error report. */
	prop_dictionary_set_int32(errdict, "errno", error);
	prop_dictionary_copyout_ioctl(pref, cmd, errdict);
	prop_object_release(errdict);
	return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:48,代码来源:npf_ctl.c


示例17: quota_handle_cmd_get_version

static int 
quota_handle_cmd_get_version(struct mount *mp, struct lwp *l, 
    prop_dictionary_t cmddict, prop_array_t datas)
{
	struct ufsmount *ump = VFSTOUFS(mp);
	prop_array_t replies;
	prop_dictionary_t data;
	int error = 0;

	if ((ump->um_flags & (UFS_QUOTA|UFS_QUOTA2)) == 0)
		return EOPNOTSUPP;

	replies = prop_array_create();
	if (replies == NULL)
		return ENOMEM;

	data = prop_dictionary_create();
	if (data == NULL) {
		prop_object_release(replies);
		return ENOMEM;
	}

#ifdef QUOTA
	if (ump->um_flags & UFS_QUOTA) {
		if (!prop_dictionary_set_int8(data, "version", 1))
			error = ENOMEM;
	} else
#endif
#ifdef QUOTA2
	if (ump->um_flags & UFS_QUOTA2) {
		if (!prop_dictionary_set_int8(data, "version", 2))
			error = ENOMEM;
	} else
#endif
		error = 0;
	if (error)
		prop_object_release(data);
	else if (!prop_array_add_and_rel(replies, data))
		error = ENOMEM;
	if (error)
		prop_object_release(replies);
	else if (!prop_dictionary_set_and_rel(cmddict, "data", replies))
		error = ENOMEM;
	return error;
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:45,代码来源:ufs_quota.c


示例18: config_hf

/*
 * Configure HF results
 */
static int
config_hf(prop_dictionary_t dict, sdp_data_t *rec)
{
	prop_object_t obj;
	sdp_data_t value;
	int32_t channel;
	uint16_t attr;

	channel = -1;

	while (sdp_get_attr(rec, &attr, &value)) {
		switch (attr) {
		case SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST:
			channel = parse_pdl(&value, SDP_UUID_PROTOCOL_RFCOMM);
			break;

		default:
			break;
		}
	}

	if (channel == -1)
		return ENOATTR;

	obj = prop_string_create_cstring_nocopy("btsco");
	if (obj == NULL || !prop_dictionary_set(dict, BTDEVtype, obj))
		return errno;

	prop_object_release(obj);

	obj = prop_bool_create(true);
	if (obj == NULL || !prop_dictionary_set(dict, BTSCOlisten, obj))
		return errno;

	prop_object_release(obj);

	obj = prop_number_create_integer(channel);
	if (obj == NULL || !prop_dictionary_set(dict, BTSCOchannel, obj))
		return errno;

	prop_object_release(obj);

	return 0;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:47,代码来源:sdp.c


示例19: prop_dictionary_set_and_rel

bool
prop_dictionary_set_and_rel(prop_dictionary_t dict, const char *key,
    prop_object_t po)
{
	bool ret;
	if (po == NULL)
		return false;
	ret = prop_dictionary_set(dict, key, po);
	prop_object_release(po);
	return ret;
}
开发者ID:0xffea,项目名称:MINIX3,代码行数:11,代码来源:prop_dictionary_util.c


示例20: hdaudioctl_get

static int
hdaudioctl_get(int fd, int argc, char *argv[])
{
	prop_dictionary_t request, response;
	prop_array_t config;
	uint16_t nid, codecid;
	const char *xml;
	int error;

	if (argc != 2)
		usage();

	codecid = strtol(argv[0], NULL, 0);
	nid = strtol(argv[1], NULL, 0);

	request = prop_dictionary_create();
	if (request == NULL) {
		fprintf(stderr, "out of memory\n");
		return ENOMEM;
	}

	prop_dictionary_set_uint16(request, "codecid", codecid);
	prop_dictionary_set_uint16(request, "nid", nid);

	error = prop_dictionary_sendrecv_ioctl(request, fd,
	    HDAUDIO_FGRP_GETCONFIG, &response);
	if (error != 0) {
		perror("HDAUDIO_FGRP_GETCONFIG failed");
		return error;
	}

	config = prop_dictionary_get(response, "pin-config");
	xml = prop_array_externalize(config);

	printf("%s\n", xml);

	prop_object_release(response);
	prop_object_release(request);

	return 0;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:41,代码来源:hdaudioctl.c



注:本文中的prop_object_release函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ prop_ref_dec函数代码示例发布时间:2022-05-30
下一篇:
C++ prop_dictionary_get函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap