PERFORCE change 103956 for review

John Birrell jb at FreeBSD.org
Tue Aug 15 02:39:02 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=103956

Change 103956 by jb at jb_freebsd2 on 2006/08/15 02:38:02

	More 'const' removal.
	
	Also remove the casts which attempted to override the consts.

Affected files ...

.. //depot/projects/dtrace/src/sys/contrib/opensolaris/common/ctf/ctf_open.c#2 edit

Differences ...

==== //depot/projects/dtrace/src/sys/contrib/opensolaris/common/ctf/ctf_open.c#2 (text) ====

@@ -25,7 +25,9 @@
  * Use is subject to license terms.
  */
 
+#if defined(sun)
 #pragma ident	"@(#)ctf_open.c	1.10	06/01/07 SMI"
+#endif
 
 #include <ctf_impl.h>
 #include <sys/mman.h>
@@ -37,8 +39,8 @@
 	{ NULL, 0, 0, 0, 0, 0, 0 }
 };
 
-const char _CTF_SECTION[] = ".SUNW_ctf";
-const char _CTF_NULLSTR[] = "";
+char _CTF_SECTION[] = ".SUNW_ctf";
+char _CTF_NULLSTR[] = "";
 
 int _libctf_version = CTF_VERSION;	/* library client version */
 int _libctf_debug = 0;			/* debugging messages enabled */
@@ -80,7 +82,7 @@
 }
 
 static const ctf_fileops_t ctf_fileops[] = {
-	{ NULL, NULL },
+	{ NULL, NULL, NULL },
 	{ get_kind_v1, get_root_v1, get_vlen_v1 },
 	{ get_kind_v2, get_root_v2, get_vlen_v2 },
 };
@@ -199,9 +201,9 @@
 init_types(ctf_file_t *fp, const ctf_header_t *cth)
 {
 	/* LINTED - pointer alignment */
-	const ctf_type_t *tbuf = (ctf_type_t *)(fp->ctf_buf + cth->cth_typeoff);
+	const ctf_type_t *tbuf = (const ctf_type_t *)(const void *)(fp->ctf_buf + cth->cth_typeoff);
 	/* LINTED - pointer alignment */
-	const ctf_type_t *tend = (ctf_type_t *)(fp->ctf_buf + cth->cth_stroff);
+	const ctf_type_t *tend = (const ctf_type_t *)(const void *)(fp->ctf_buf + cth->cth_stroff);
 
 	ulong_t pop[CTF_K_MAX + 1] = { 0 };
 	const ctf_type_t *tp;
@@ -479,7 +481,7 @@
 			 * in fp->ctf_ptrtab[ index of referenced type ].
 			 */
 			if (CTF_TYPE_ISCHILD(tp->ctt_type) == child &&
-			    CTF_TYPE_TO_INDEX(tp->ctt_type) <= fp->ctf_typemax)
+			    CTF_TYPE_TO_INDEX(tp->ctt_type) <= (long) fp->ctf_typemax)
 				fp->ctf_ptrtab[
 				    CTF_TYPE_TO_INDEX(tp->ctt_type)] = id;
 			/*FALLTHRU*/
@@ -524,7 +526,7 @@
 			if (LCTF_INFO_KIND(fp, tp->ctt_info) == CTF_K_TYPEDEF &&
 			    strcmp(ctf_strptr(fp, tp->ctt_name), "") == 0 &&
 			    CTF_TYPE_ISCHILD(tp->ctt_type) == child &&
-			    CTF_TYPE_TO_INDEX(tp->ctt_type) <= fp->ctf_typemax)
+			    CTF_TYPE_TO_INDEX(tp->ctt_type) <= (long) fp->ctf_typemax)
 				fp->ctf_ptrtab[
 				    CTF_TYPE_TO_INDEX(tp->ctt_type)] = dst;
 		}
@@ -828,24 +830,24 @@
 
 	if (fp->ctf_data.cts_name != _CTF_NULLSTR &&
 	    fp->ctf_data.cts_name != NULL) {
-		ctf_free((char *)fp->ctf_data.cts_name,
+		ctf_free(fp->ctf_data.cts_name,
 		    strlen(fp->ctf_data.cts_name) + 1);
 	}
 
 	if (fp->ctf_symtab.cts_name != _CTF_NULLSTR &&
 	    fp->ctf_symtab.cts_name != NULL) {
-		ctf_free((char *)fp->ctf_symtab.cts_name,
+		ctf_free(fp->ctf_symtab.cts_name,
 		    strlen(fp->ctf_symtab.cts_name) + 1);
 	}
 
 	if (fp->ctf_strtab.cts_name != _CTF_NULLSTR &&
 	    fp->ctf_strtab.cts_name != NULL) {
-		ctf_free((char *)fp->ctf_strtab.cts_name,
+		ctf_free(fp->ctf_strtab.cts_name,
 		    strlen(fp->ctf_strtab.cts_name) + 1);
 	}
 
 	if (fp->ctf_base != fp->ctf_data.cts_data && fp->ctf_base != NULL)
-		ctf_data_free((void *)fp->ctf_base, fp->ctf_size);
+		ctf_data_free(fp->ctf_base, fp->ctf_size);
 
 	if (fp->ctf_sxlate != NULL)
 		ctf_free(fp->ctf_sxlate, sizeof (uint_t) * fp->ctf_nsyms);


More information about the p4-projects mailing list