goprotobuf: remove unsafe from properties.go
The old reflect world made unsafeness worthwhile here; it's not now.

R=golang-dev, rsc
CC=golang-dev
http://codereview.appspot.com/5318042
diff --git a/proto/properties.go b/proto/properties.go
index fc24517..e74674d 100644
--- a/proto/properties.go
+++ b/proto/properties.go
@@ -43,7 +43,6 @@
 	"strconv"
 	"strings"
 	"sync"
-	"unsafe"
 )
 
 const debug bool = false
@@ -116,8 +115,8 @@
 	tagbuf  [8]byte
 	stype   reflect.Type
 
-	dec    decoder
-	valDec valueDecoder // set for bool and numeric types only
+	dec     decoder
+	valDec  valueDecoder // set for bool and numeric types only
 
 	// If this is a packable field, this will be the decoder for the packed version of the field.
 	packedDec decoder
@@ -477,18 +476,20 @@
 }
 
 // Get the address and type of a pointer to a struct from an interface.
-// unsafe.Reflect can do this, but does multiple mallocs.
 func getbase(pb interface{}) (t reflect.Type, b uintptr, err os.Error) {
-	// get pointer
-	x := *(*[2]uintptr)(unsafe.Pointer(&pb))
-	b = x[1]
-	if b == 0 {
+	if pb == nil {
 		err = ErrNil
 		return
 	}
-
-	// get the reflect type of the struct.
+	// get the reflect type of the pointer to the struct.
 	t = reflect.TypeOf(pb)
+	if t.Kind() != reflect.Ptr {
+		err = ErrNotPtr
+		return
+	}
+	// get the address of the struct.
+	value := reflect.ValueOf(pb)
+	b = value.Pointer()
 	return
 }