From: David Bremner Date: Wed, 23 Sep 2015 11:59:14 +0000 (+2100) Subject: [PATCH] lib: constify arguments to notmuch_query_get_* X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5c3403fbd2898f0aa6d266e395a7186793851379;p=notmuch-archives.git [PATCH] lib: constify arguments to notmuch_query_get_* --- diff --git a/bf/af42475b0132b8941dd8fad3623cc848e321de b/bf/af42475b0132b8941dd8fad3623cc848e321de new file mode 100644 index 000000000..a00afe688 --- /dev/null +++ b/bf/af42475b0132b8941dd8fad3623cc848e321de @@ -0,0 +1,115 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 3A1836DE1648 + for ; Wed, 23 Sep 2015 05:00:27 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.113 +X-Spam-Level: +X-Spam-Status: No, score=0.113 tagged_above=-999 required=5 tests=[AWL=0.113] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id tz5cnjo6HyLx for ; + Wed, 23 Sep 2015 05:00:25 -0700 (PDT) +Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224]) + by arlo.cworth.org (Postfix) with ESMTPS id 2B4FC6DE1603 + for ; Wed, 23 Sep 2015 05:00:25 -0700 (PDT) +Received: from remotemail by gitolite.debian.net with local (Exim 4.80) + (envelope-from ) + id 1Zeii6-0001x2-Pv; Wed, 23 Sep 2015 11:59:42 +0000 +Received: (nullmailer pid 26809 invoked by uid 1000); Wed, 23 Sep 2015 + 11:59:23 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH] lib: constify arguments to notmuch_query_get_* +Date: Wed, 23 Sep 2015 08:59:14 -0300 +Message-Id: <1443009554-26766-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.5.1 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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, 23 Sep 2015 12:00:27 -0000 + +These functions are all just accessors, and it's pretty clear they don't +modify the query struct. This also fixes one warning I created when I +introduced status.c. +--- + lib/notmuch.h | 6 +++--- + lib/query.cc | 6 +++--- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/lib/notmuch.h b/lib/notmuch.h +index 86b5b4d..8775683 100644 +--- a/lib/notmuch.h ++++ b/lib/notmuch.h +@@ -728,13 +728,13 @@ typedef enum { + * Return the query_string of this query. See notmuch_query_create. + */ + const char * +-notmuch_query_get_query_string (notmuch_query_t *query); ++notmuch_query_get_query_string (const notmuch_query_t *query); + + /** + * Return the notmuch database of this query. See notmuch_query_create. + */ + notmuch_database_t * +-notmuch_query_get_database (notmuch_query_t *query); ++notmuch_query_get_database (const notmuch_query_t *query); + + /** + * Exclude values for notmuch_query_set_omit_excluded. The strange +@@ -791,7 +791,7 @@ notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort); + * notmuch_query_set_sort. + */ + notmuch_sort_t +-notmuch_query_get_sort (notmuch_query_t *query); ++notmuch_query_get_sort (const notmuch_query_t *query); + + /** + * Add a tag that will be excluded from the query results by default. +diff --git a/lib/query.cc b/lib/query.cc +index f53215d..8cf0a07 100644 +--- a/lib/query.cc ++++ b/lib/query.cc +@@ -98,7 +98,7 @@ notmuch_query_create (notmuch_database_t *notmuch, + } + + const char * +-notmuch_query_get_query_string (notmuch_query_t *query) ++notmuch_query_get_query_string (const notmuch_query_t *query) + { + return query->query_string; + } +@@ -117,7 +117,7 @@ notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort) + } + + notmuch_sort_t +-notmuch_query_get_sort (notmuch_query_t *query) ++notmuch_query_get_sort (const notmuch_query_t *query) + { + return query->sort; + } +@@ -660,7 +660,7 @@ notmuch_query_count_threads (notmuch_query_t *query) + } + + notmuch_database_t * +-notmuch_query_get_database (notmuch_query_t *query) ++notmuch_query_get_database (const notmuch_query_t *query) + { + return query->notmuch; + } +-- +2.5.1 +