Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jun 2018 21:23:41 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335342 - in head: share/man/man9 sys/contrib/libnv sys/sys
Message-ID:  <201806182123.w5ILNflk090049@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oshogbo
Date: Mon Jun 18 21:23:40 2018
New Revision: 335342
URL: https://svnweb.freebsd.org/changeset/base/335342

Log:
  libnv: add const to cookies arguments
  
  Pointed out by:	pjd@

Modified:
  head/share/man/man9/cnv.9
  head/sys/contrib/libnv/cnvlist.c
  head/sys/sys/cnv.h

Modified: head/share/man/man9/cnv.9
==============================================================================
--- head/share/man/man9/cnv.9	Mon Jun 18 21:18:20 2018	(r335341)
+++ head/share/man/man9/cnv.9	Mon Jun 18 21:23:40 2018	(r335342)
@@ -38,32 +38,32 @@
 .Sh SYNOPSIS
 .In sys/cnv.h
 .Ft const char *
-.Fn cnvlist_name "void *cookie"
+.Fn cnvlist_name "const void *cookie"
 .Ft int
-.Fn cnvlist_type "void *cookie"
+.Fn cnvlist_type "const void *cookie"
 .\"
 .Ft bool
-.Fn cnvlist_get_bool "void *cookie"
+.Fn cnvlist_get_bool "const void *cookie"
 .Ft uint64_t
-.Fn cnvlist_get_number "void *cookie"
+.Fn cnvlist_get_number "const void *cookie"
 .Ft "const char *"
-.Fn cnvlist_get_string "void *cookie"
+.Fn cnvlist_get_string "const void *cookie"
 .Ft "const nvlist_t *"
-.Fn cnvlist_get_nvlist "void *cookie"
+.Fn cnvlist_get_nvlist "const void *cookie"
 .Ft "const void *"
-.Fn cnvlist_get_binary "void *cookie" "size_t *sizep"
+.Fn cnvlist_get_binary "const void *cookie" "size_t *sizep"
 .Ft "const bool *"
-.Fn cnvlist_get_bool_array "void *cookie" "size_t *nitemsp"
+.Fn cnvlist_get_bool_array "const void *cookie" "size_t *nitemsp"
 .Ft "const uint64_t *"
-.Fn cnvlist_get_number_array "void *cookie" "size_t *nitemsp"
+.Fn cnvlist_get_number_array "const void *cookie" "size_t *nitemsp"
 .Ft "const char * const *"
-.Fn cnvlist_get_string_array "void *cookie" "size_t *nitemsp"
+.Fn cnvlist_get_string_array "const void *cookie" "size_t *nitemsp"
 .Ft "const nvlist_t * const *"
-.Fn cnvlist_get_nvlist_array "void *cookie" "size_t *nitemsp"
+.Fn cnvlist_get_nvlist_array "const void *cookie" "size_t *nitemsp"
 .Ft int
-.Fn cnvlist_get_descriptor "void *cookie"
+.Fn cnvlist_get_descriptor "const void *cookie"
 .Ft "const int *"
-.Fn cnvlist_get_descriptor_array "void *cookie" "size_t *nitemsp"
+.Fn cnvlist_get_descriptor_array "const void *cookie" "size_t *nitemsp"
 .\"
 .Ft bool
 .Fn cnvlist_take_bool "nvlist_t *nvl" "void *cookie"

Modified: head/sys/contrib/libnv/cnvlist.c
==============================================================================
--- head/sys/contrib/libnv/cnvlist.c	Mon Jun 18 21:18:20 2018	(r335341)
+++ head/sys/contrib/libnv/cnvlist.c	Mon Jun 18 21:23:40 2018	(r335342)
@@ -56,14 +56,14 @@ __FBSDID("$FreeBSD$");
 #include "nvpair_impl.h"
 
 const char *
-cnvlist_name(void *cookie)
+cnvlist_name(const void *cookie)
 {
 
 	return (nvpair_name(cookie));
 }
 
 int
-cnvlist_type(void *cookie)
+cnvlist_type(const void *cookie)
 {
 
 	return (nvpair_type(cookie));
@@ -71,7 +71,7 @@ cnvlist_type(void *cookie)
 
 #define	CNVLIST_GET(ftype, type, NVTYPE)				\
 ftype									\
-cnvlist_get_##type(void *cookie)					\
+cnvlist_get_##type(const void *cookie)					\
 {									\
 									\
 	if (nvpair_type(cookie) != NV_TYPE_##NVTYPE) {			\
@@ -93,7 +93,7 @@ CNVLIST_GET(int, descriptor, DESCRIPTOR)
 
 #define	CNVLIST_GET_ARRAY(ftype, type, NVTYPE)				\
 ftype									\
-cnvlist_get_##type(void *cookie, size_t *nitemsp)			\
+cnvlist_get_##type(const void *cookie, size_t *nitemsp)			\
 {									\
 									\
 	if (nvpair_type(cookie) != NV_TYPE_##NVTYPE) {			\
@@ -114,7 +114,7 @@ CNVLIST_GET_ARRAY(const int *, descriptor_array, DESCR
 #undef	CNVLIST_GET_ARRAY
 
 const void *
-cnvlist_get_binary(void *cookie, size_t *sizep)
+cnvlist_get_binary(const void *cookie, size_t *sizep)
 {
 
 	if (nvpair_type(cookie) != NV_TYPE_BINARY)

Modified: head/sys/sys/cnv.h
==============================================================================
--- head/sys/sys/cnv.h	Mon Jun 18 21:18:20 2018	(r335341)
+++ head/sys/sys/cnv.h	Mon Jun 18 21:23:40 2018	(r335342)
@@ -52,8 +52,8 @@ __BEGIN_DECLS
 /*
  * Functions which returns information about the given cookie.
  */
-const char	*cnvlist_name(void *cookie);
-int		 cnvlist_type(void *cookie);
+const char	*cnvlist_name(const void *cookie);
+int		 cnvlist_type(const void *cookie);
 
 /*
  * The cnvlist_get functions returns value associated with the given cookie.
@@ -61,18 +61,18 @@ int		 cnvlist_type(void *cookie);
  * not be freed by the caller.
  */
 
-bool			 cnvlist_get_bool(void *cookie);
-uint64_t		 cnvlist_get_number(void *cookie);
-const char		*cnvlist_get_string(void *cookie);
-const nvlist_t		*cnvlist_get_nvlist(void *cookie);
-const void		*cnvlist_get_binary(void *cookie, size_t *sizep);
-const bool		*cnvlist_get_bool_array(void *cookie, size_t *nitemsp);
-const uint64_t		*cnvlist_get_number_array(void *cookie, size_t *nitemsp);
-const char * const	*cnvlist_get_string_array(void *cookie, size_t *nitemsp);
-const nvlist_t * const	*cnvlist_get_nvlist_array(void *cookie, size_t *nitemsp);
+bool			 cnvlist_get_bool(const void *cookie);
+uint64_t		 cnvlist_get_number(const void *cookie);
+const char		*cnvlist_get_string(const void *cookie);
+const nvlist_t		*cnvlist_get_nvlist(const void *cookie);
+const void		*cnvlist_get_binary(const void *cookie, size_t *sizep);
+const bool		*cnvlist_get_bool_array(const void *cookie, size_t *nitemsp);
+const uint64_t		*cnvlist_get_number_array(const void *cookie, size_t *nitemsp);
+const char * const	*cnvlist_get_string_array(const void *cookie, size_t *nitemsp);
+const nvlist_t * const	*cnvlist_get_nvlist_array(const void *cookie, size_t *nitemsp);
 #ifndef _KERNEL
-int			 cnvlist_get_descriptor(void *cookie);
-const int		*cnvlist_get_descriptor_array(void *cookie, size_t *nitemsp);
+int			 cnvlist_get_descriptor(const void *cookie);
+const int		*cnvlist_get_descriptor_array(const void *cookie, size_t *nitemsp);
 #endif
 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806182123.w5ILNflk090049>