From 4c4967f830ea820e8a87d406b9012743929a055b Mon Sep 17 00:00:00 2001 From: Adrien Bustany Date: Wed, 18 Jul 2012 21:34:29 +0300 Subject: [PATCH] [PATCH 1/7] go: Use iota in enum bindings --- 6b/74e36a1229b2986fd3ee04462dc7aae7ace78c | 85 +++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 6b/74e36a1229b2986fd3ee04462dc7aae7ace78c diff --git a/6b/74e36a1229b2986fd3ee04462dc7aae7ace78c b/6b/74e36a1229b2986fd3ee04462dc7aae7ace78c new file mode 100644 index 000000000..53dd834fb --- /dev/null +++ b/6b/74e36a1229b2986fd3ee04462dc7aae7ace78c @@ -0,0 +1,85 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 499FF431FAF + for ; Wed, 18 Jul 2012 11:41:06 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 5N6vU8HQ8vua for ; + Wed, 18 Jul 2012 11:41:05 -0700 (PDT) +Received: from mail.bustany.org (bustany.org [176.31.244.208]) + by olra.theworths.org (Postfix) with ESMTP id DD652431FBD + for ; Wed, 18 Jul 2012 11:41:04 -0700 (PDT) +Received: from localhost.localdomain (91-158-2-79.elisa-laajakaista.fi + [91.158.2.79]) + by mail.bustany.org (Postfix) with ESMTPSA id B19371400C0 + for ; Wed, 18 Jul 2012 20:37:07 +0200 (CEST) +From: Adrien Bustany +To: notmuch@notmuchmail.org +Subject: [PATCH 1/7] go: Use iota in enum bindings +Date: Wed, 18 Jul 2012 21:34:29 +0300 +Message-Id: <1342636475-16057-2-git-send-email-adrien@bustany.org> +X-Mailer: git-send-email 1.7.7.6 +In-Reply-To: <1342636475-16057-1-git-send-email-adrien@bustany.org> +References: <1342636475-16057-1-git-send-email-adrien@bustany.org> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 18 Jul 2012 18:41:06 -0000 + +Using iota is the correct way to get the values in the enum increment +automatically. The old code would just set all the enum values to 0. +--- + bindings/go/src/notmuch/notmuch.go | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go +index 00bd53a..ecd7418 100644 +--- a/bindings/go/src/notmuch/notmuch.go ++++ b/bindings/go/src/notmuch/notmuch.go +@@ -86,7 +86,7 @@ type Filenames struct { + type DatabaseMode C.notmuch_database_mode_t + + const ( +- DATABASE_MODE_READ_ONLY DatabaseMode = 0 ++ DATABASE_MODE_READ_ONLY DatabaseMode = iota + DATABASE_MODE_READ_WRITE + ) + +@@ -386,7 +386,7 @@ func (self *Database) CreateQuery(query string) *Query { + type Sort C.notmuch_sort_t + + const ( +- SORT_OLDEST_FIRST Sort = 0 ++ SORT_OLDEST_FIRST Sort = iota + SORT_NEWEST_FIRST + SORT_MESSAGE_ID + SORT_UNSORTED +@@ -774,7 +774,7 @@ func (self *Message) GetFileName() string { + type Flag C.notmuch_message_flag_t + + const ( +- MESSAGE_FLAG_MATCH Flag = 0 ++ MESSAGE_FLAG_MATCH Flag = iota + ) + + /* Get a value of a flag for the email corresponding to 'message'. */ +-- +1.7.7.6 + -- 2.26.2