Ejemplo n.º 1
0
static void delete_prop(ast_prop const *p)
{
  switch (p->type) {
  case PROP_AND:
  case PROP_OR:
  case PROP_IMPL:
    delete_prop(p->rhs);
    // no break
  case PROP_NOT:
    delete_prop(p->lhs);
    break;
  case PROP_ATOM:
    delete p->atom;
  }
  delete p;
}
Ejemplo n.º 2
0
/* path is the name of the property to delete */
PropPtr
propdir_delete_elem(PropPtr root, char *path)
{
	PropPtr p;
	char *n;

	if (!root)
		return (NULL);
	while (*path && *path == PROPDIR_DELIMITER)
		path++;
	if (!*path)
		return (root);
	n = index(path, PROPDIR_DELIMITER);
	while (n && *n == PROPDIR_DELIMITER)
		*(n++) = '\0';
	if (n && *n) {
		/* just another propdir in the path */
		p = locate_prop(root, path);
		if (p && PropDir(p)) {
			/* yup, found the propdir */
			SetPDir(p, propdir_delete_elem(PropDir(p), n));
			if (!PropDir(p) && PropType(p) == PROP_DIRTYP) {
				root = delete_prop(&root, PropName(p));
			}
		}
		/* return the updated root pntr */
		return (root);
	} else {
		/* aha, we are finally to the property itself. */
		p = locate_prop(root, path);
		if (p && PropDir(p)) {
			delete_proplist(PropDir(p));
		}
		(void) delete_prop(&root, path);
		return (root);
	}
}
Ejemplo n.º 3
0
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
{
    DispatchEx *This = DISPATCHEX_THIS(iface);
    dispex_prop_t *prop;

    TRACE("(%p)->(%x)\n", This, id);

    prop = get_prop(This, id);
    if(!prop) {
        WARN("invalid id\n");
        return DISP_E_MEMBERNOTFOUND;
    }

    return delete_prop(prop);
}
Ejemplo n.º 4
0
static void
commit_props(const scf_instance_t *inst, inetd_prop_t *mod, boolean_t defaults)
{
	int			i;
	uint8_t			new_bool;

	for (i = 0; mod[i].ip_name != NULL; i++) {
		switch (mod[i].ip_error) {
		case IVE_UNSET:
			break;
		case IVE_INVALID:
			delete_prop(inst, mod[i].ip_pg, mod[i].ip_name);
			break;
		case IVE_VALID:
			switch (mod[i].ip_type) {
			case INET_TYPE_STRING:
				modify_prop(inst,
				    defaults ? PG_NAME_SERVICE_DEFAULTS :
				    mod[i].ip_pg, mod[i].ip_name,
				    SCF_TYPE_ASTRING,
				    mod[i].ip_value.iv_string);
				break;
			case INET_TYPE_STRING_LIST:
				modify_prop(inst,
				    defaults ? PG_NAME_SERVICE_DEFAULTS :
				    mod[i].ip_pg, mod[i].ip_name,
				    SCF_TYPE_ASTRING,
				    mod[i].ip_value.iv_string_list);
				break;
			case INET_TYPE_INTEGER:
				modify_prop(inst,
				    defaults ? PG_NAME_SERVICE_DEFAULTS :
				    mod[i].ip_pg, mod[i].ip_name,
				    SCF_TYPE_INTEGER, &mod[i].ip_value.iv_int);
				break;
			case INET_TYPE_BOOLEAN:
				new_bool = (mod[i].ip_value.iv_boolean) ? 1 : 0;

				modify_prop(inst,
				    defaults ? PG_NAME_SERVICE_DEFAULTS :
				    mod[i].ip_pg, mod[i].ip_name,
				    SCF_TYPE_BOOLEAN, &new_bool);
				break;
			}
		}
	}
}
Ejemplo n.º 5
0
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
{
    DispatchEx *This = DISPATCHEX_THIS(iface);
    dispex_prop_t *prop;
    HRESULT hres;

    TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);

    if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit))
        FIXME("Unsupported grfdex %x\n", grfdex);

    hres = find_prop_name(This, bstrName, &prop);
    if(FAILED(hres))
        return hres;
    if(!prop) {
        TRACE("not found\n");
        return S_OK;
    }

    return delete_prop(prop);
}
Ejemplo n.º 6
0
void parse_property_tree(property_tree &tree, ast_prop const *p)
{
  tree = new property_tree::data(false);
  generate_tree(tree, p, true);
  delete_prop(p);
}