Update for proplib(3) API changes.

This commit is contained in:
thorpej 2020-06-06 22:33:23 +00:00
parent 44b8317b39
commit aebbed3d12
2 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: veriexecctl.h,v 1.11 2008/08/31 23:37:45 dholland Exp $ */ /* $NetBSD: veriexecctl.h,v 1.12 2020/06/06 22:36:39 thorpej Exp $ */
/*- /*-
* Copyright 2005 Elad Efrat <elad@NetBSD.org> * Copyright 2005 Elad Efrat <elad@NetBSD.org>
@ -34,15 +34,15 @@
#define _VERIEXECCTL_H_ #define _VERIEXECCTL_H_
#define dict_sets(d, k, v) \ #define dict_sets(d, k, v) \
prop_dictionary_set(d, k, prop_string_create_cstring(v)) prop_dictionary_set_string(d, k, v)
#define dict_gets(d, k) \ #define dict_gets(d, k) \
prop_string_cstring_nocopy(prop_dictionary_get(d, k)) prop_string_value(prop_dictionary_get(d, k))
#define dict_setd(d, k, v, n) \ #define dict_setd(d, k, v, n) \
prop_dictionary_set(d, k, prop_data_create_data(v, n)) prop_dictionary_set_data(d, k, v, n)
#define dict_getd(d, k) \ #define dict_getd(d, k) \
prop_data_data_nocopy(prop_dictionary_get(d, k)) prop_data_value(prop_dictionary_get(d, k))
#endif /* _VERIEXECCTL_H_ */ #endif /* _VERIEXECCTL_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofctl.c,v 1.14 2018/05/28 12:42:45 wiz Exp $ */ /* $NetBSD: ofctl.c,v 1.15 2020/06/06 22:33:23 thorpej Exp $ */
/*- /*-
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
#ifndef lint #ifndef lint
__COPYRIGHT("@(#) Copyright (c) 2006, 2007\ __COPYRIGHT("@(#) Copyright (c) 2006, 2007\
The NetBSD Foundation, Inc. All rights reserved."); The NetBSD Foundation, Inc. All rights reserved.");
__RCSID("$NetBSD: ofctl.c,v 1.14 2018/05/28 12:42:45 wiz Exp $"); __RCSID("$NetBSD: ofctl.c,v 1.15 2020/06/06 22:33:23 thorpej Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdio.h> #include <stdio.h>
@ -108,7 +108,7 @@ of_tree_mkprop(struct of_node *node, prop_dictionary_t propdict,
prop_data_t obj; prop_data_t obj;
const char *name; const char *name;
name = prop_dictionary_keysym_cstring_nocopy(key); name = prop_dictionary_keysym_value(key);
obj = prop_dictionary_get_keysym(propdict, key); obj = prop_dictionary_get_keysym(propdict, key);
prop = malloc(sizeof(*prop) + strlen(name) + 1); prop = malloc(sizeof(*prop) + strlen(name) + 1);
@ -131,8 +131,10 @@ of_tree_mkprop(struct of_node *node, prop_dictionary_t propdict,
of_prop_count++; of_prop_count++;
prop->prop_length = prop_data_size(obj); prop->prop_length = prop_data_size(obj);
if (prop->prop_length) if (prop->prop_length) {
prop->prop_data = prop_data_data(obj); prop->prop_data = malloc(prop->prop_length);
prop_data_copy_value(obj, prop->prop_data, prop->prop_length);
}
} }
static struct of_node * static struct of_node *
@ -163,7 +165,7 @@ of_tree_fill(prop_dictionary_t dict, struct of_node *node)
prop_array_t children; prop_array_t children;
unsigned int i, count; unsigned int i, count;
node->of_nodeid = prop_number_unsigned_integer_value( node->of_nodeid = prop_number_unsigned_value(
prop_dictionary_get(dict, "node")); prop_dictionary_get(dict, "node"));
propdict = prop_dictionary_get(dict, "properties"); propdict = prop_dictionary_get(dict, "properties");
@ -224,7 +226,7 @@ of_proplib_mkprop(int fd, int nodeid, char *name)
free(ofio.of_buf); free(ofio.of_buf);
return NULL; return NULL;
} }
obj = prop_data_create_data(ofio.of_buf, ofio.of_buflen); obj = prop_data_create_copy(ofio.of_buf, ofio.of_buflen);
free(ofio.of_buf); free(ofio.of_buf);
return obj; return obj;
} }
@ -249,7 +251,7 @@ of_proplib_tree_fill(int fd, int nodeid)
dict = prop_dictionary_create(); dict = prop_dictionary_create();
prop_dictionary_set(dict, "node", prop_dictionary_set(dict, "node",
prop_number_create_unsigned_integer(nodeid)); prop_number_create_unsigned(nodeid));
propdict = prop_dictionary_create(); propdict = prop_dictionary_create();
for (;;) { for (;;) {