go: format the souce code using gofmt

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
This commit is contained in:
Justus Winter 2012-05-09 13:15:20 +02:00 committed by David Bremner
parent 3113731713
commit 1952889353
2 changed files with 85 additions and 82 deletions

View file

@ -22,18 +22,18 @@ type frequencies map[string]uint
/* Used to sort the email addresses from most to least used */ /* Used to sort the email addresses from most to least used */
func sort_by_freq(m1, m2 *mail_addr_freq) int { func sort_by_freq(m1, m2 *mail_addr_freq) int {
if (m1.count[0] == m2.count[0] && if m1.count[0] == m2.count[0] &&
m1.count[1] == m2.count[1] && m1.count[1] == m2.count[1] &&
m1.count[2] == m2.count[2]) { m1.count[2] == m2.count[2] {
return 0 return 0
} }
if (m1.count[0] > m2.count[0] || if m1.count[0] > m2.count[0] ||
m1.count[0] == m2.count[0] && m1.count[0] == m2.count[0] &&
m1.count[1] > m2.count[1] || m1.count[1] > m2.count[1] ||
m1.count[0] == m2.count[0] && m1.count[0] == m2.count[0] &&
m1.count[1] == m2.count[1] && m1.count[1] == m2.count[1] &&
m1.count[2] > m2.count[2]) { m1.count[2] > m2.count[2] {
return -1 return -1
} }

View file

@ -15,6 +15,7 @@ import "unsafe"
// Status codes used for the return values of most functions // Status codes used for the return values of most functions
type Status C.notmuch_status_t type Status C.notmuch_status_t
const ( const (
STATUS_SUCCESS Status = iota STATUS_SUCCESS Status = iota
STATUS_OUT_OF_MEMORY STATUS_OUT_OF_MEMORY
@ -83,6 +84,7 @@ type Filenames struct {
} }
type DatabaseMode C.notmuch_database_mode_t type DatabaseMode C.notmuch_database_mode_t
const ( const (
DATABASE_MODE_READ_ONLY DatabaseMode = 0 DATABASE_MODE_READ_ONLY DatabaseMode = 0
DATABASE_MODE_READ_WRITE DATABASE_MODE_READ_WRITE
@ -181,7 +183,6 @@ func (self *Database) NeedsUpgrade() bool {
// TODO: notmuch_database_upgrade // TODO: notmuch_database_upgrade
/* Retrieve a directory object from the database for 'path'. /* Retrieve a directory object from the database for 'path'.
* *
* Here, 'path' should be a path relative to the path of 'database' * Here, 'path' should be a path relative to the path of 'database'
@ -245,8 +246,7 @@ func (self *Database) GetDirectory(path string) *Directory {
* NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
* mode so no message can be added. * mode so no message can be added.
*/ */
func func (self *Database) AddMessage(fname string) (*Message, Status) {
(self *Database) AddMessage(fname string) (*Message, Status) {
var c_fname *C.char = C.CString(fname) var c_fname *C.char = C.CString(fname)
defer C.free(unsafe.Pointer(c_fname)) defer C.free(unsafe.Pointer(c_fname))
@ -383,6 +383,7 @@ func (self *Database) CreateQuery(query string) *Query {
/* Sort values for notmuch_query_set_sort */ /* Sort values for notmuch_query_set_sort */
type Sort C.notmuch_sort_t type Sort C.notmuch_sort_t
const ( const (
SORT_OLDEST_FIRST Sort = 0 SORT_OLDEST_FIRST Sort = 0
SORT_NEWEST_FIRST SORT_NEWEST_FIRST
@ -770,6 +771,7 @@ func (self *Message) GetFileName() string {
} }
type Flag C.notmuch_message_flag_t type Flag C.notmuch_message_flag_t
const ( const (
MESSAGE_FLAG_MATCH Flag = 0 MESSAGE_FLAG_MATCH Flag = 0
) )
@ -1124,4 +1126,5 @@ func (self *Filenames) Destroy() {
} }
C.notmuch_filenames_destroy(self.fnames) C.notmuch_filenames_destroy(self.fnames)
} }
/* EOF */ /* EOF */