[Groonga-commit] groonga/grngo at 49bc027 [master] Use new(...) instead of the address of a local variable.

Back to archive index

susumu.yata null+****@clear*****
Fri Jul 10 14:49:04 JST 2015


susumu.yata	2015-07-10 14:49:04 +0900 (Fri, 10 Jul 2015)

  New Revision: 49bc02716fa1bb0cd27b45678f3b5c211c1f77fe
  https://github.com/groonga/grngo/commit/49bc02716fa1bb0cd27b45678f3b5c211c1f77fe

  Message:
    Use new(...) instead of the address of a local variable.

  Modified files:
    grngo.go

  Modified: grngo.go (+10 -5)
===================================================================
--- grngo.go    2015-07-09 15:41:32 +0900 (507ddb3)
+++ grngo.go    2015-07-10 14:49:04 +0900 (a1626db)
@@ -337,9 +337,9 @@ type TableOptions struct {
 
 // NewTableOptions returns a new TableOptions with the default settings.
 func NewTableOptions() *TableOptions {
-	var options TableOptions
+	options := new(TableOptions)
 	options.Flags = TableHashKey
-	return &options
+	return options
 }
 
 // -- ColumnOptions --
@@ -367,8 +367,9 @@ type ColumnOptions struct {
 
 // NewColumnOptions returns a new ColumnOptions with the default settings.
 func NewColumnOptions() *ColumnOptions {
-	var options ColumnOptions
-	return &options
+	options := new(ColumnOptions)
+	options.Flags = CompressNone
+	return options
 }
 
 // -- Groonga --
@@ -458,7 +459,11 @@ type DB struct {
 
 // newDB returns a new DB.
 func newDB(ctx *C.grn_ctx, obj *C.grn_obj) *DB {
-	return &DB{ctx, obj, make(map[string]*Table)}
+	db := new(DB)
+	db.ctx = ctx
+	db.obj = obj
+	db.tables = make(map[string]*Table)
+	return db
 }
 
 // CreateDB creates a Groonga database and returns a new DB associated with it.
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index