From aebbed3d12579fb5c4f8d4ff9bb2a5a239ceea15 Mon Sep 17 00:00:00 2001 From: thorpej Date: Sat, 6 Jun 2020 22:33:23 +0000 Subject: [PATCH] Update for proplib(3) API changes. --- sbin/veriexecctl/veriexecctl.h | 10 +++++----- usr.sbin/ofctl/ofctl.c | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sbin/veriexecctl/veriexecctl.h b/sbin/veriexecctl/veriexecctl.h index 22d24438272a..ef43025ffe57 100644 --- a/sbin/veriexecctl/veriexecctl.h +++ b/sbin/veriexecctl/veriexecctl.h @@ -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 @@ -34,15 +34,15 @@ #define _VERIEXECCTL_H_ #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) \ - prop_string_cstring_nocopy(prop_dictionary_get(d, k)) + prop_string_value(prop_dictionary_get(d, k)) #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) \ - prop_data_data_nocopy(prop_dictionary_get(d, k)) + prop_data_value(prop_dictionary_get(d, k)) #endif /* _VERIEXECCTL_H_ */ diff --git a/usr.sbin/ofctl/ofctl.c b/usr.sbin/ofctl/ofctl.c index 9d8946989fa7..bf54791c46a1 100644 --- a/usr.sbin/ofctl/ofctl.c +++ b/usr.sbin/ofctl/ofctl.c @@ -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. @@ -34,7 +34,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 2006, 2007\ 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 */ #include @@ -108,7 +108,7 @@ of_tree_mkprop(struct of_node *node, prop_dictionary_t propdict, prop_data_t obj; const char *name; - name = prop_dictionary_keysym_cstring_nocopy(key); + name = prop_dictionary_keysym_value(key); obj = prop_dictionary_get_keysym(propdict, key); 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++; prop->prop_length = prop_data_size(obj); - if (prop->prop_length) - prop->prop_data = prop_data_data(obj); + if (prop->prop_length) { + prop->prop_data = malloc(prop->prop_length); + prop_data_copy_value(obj, prop->prop_data, prop->prop_length); + } } static struct of_node * @@ -163,7 +165,7 @@ of_tree_fill(prop_dictionary_t dict, struct of_node *node) prop_array_t children; unsigned int i, count; - node->of_nodeid = prop_number_unsigned_integer_value( + node->of_nodeid = prop_number_unsigned_value( prop_dictionary_get(dict, "node")); propdict = prop_dictionary_get(dict, "properties"); @@ -224,7 +226,7 @@ of_proplib_mkprop(int fd, int nodeid, char *name) free(ofio.of_buf); 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); return obj; } @@ -249,7 +251,7 @@ of_proplib_tree_fill(int fd, int nodeid) dict = prop_dictionary_create(); prop_dictionary_set(dict, "node", - prop_number_create_unsigned_integer(nodeid)); + prop_number_create_unsigned(nodeid)); propdict = prop_dictionary_create(); for (;;) {