From: Tomi Ollila Date: Thu, 7 Nov 2013 13:13:59 +0000 (+0200) Subject: Re: [PATCH] lib: add library version check macro X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b775fdf4f2011facba68e782e3bb80fd10b92170;p=notmuch-archives.git Re: [PATCH] lib: add library version check macro --- diff --git a/67/6882777d14c4c570d06f10a8b64e76fe86e441 b/67/6882777d14c4c570d06f10a8b64e76fe86e441 new file mode 100644 index 000000000..eec697e40 --- /dev/null +++ b/67/6882777d14c4c570d06f10a8b64e76fe86e441 @@ -0,0 +1,110 @@ +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 19C45431FBD + for ; Thu, 7 Nov 2013 05:14:16 -0800 (PST) +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 S81In-yVBqkC for ; + Thu, 7 Nov 2013 05:14:07 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id CEF75431FAE + for ; Thu, 7 Nov 2013 05:14:06 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 3CED3100051; + Thu, 7 Nov 2013 15:14:00 +0200 (EET) +From: Tomi Ollila +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH] lib: add library version check macro +In-Reply-To: <1383764501-18973-1-git-send-email-jani@nikula.org> +References: <1383764501-18973-1-git-send-email-jani@nikula.org> +User-Agent: Notmuch/0.16+119~g219c55f (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Thu, 07 Nov 2013 13:14:16 -0000 + +On Wed, Nov 06 2013, Jani Nikula wrote: + +> There have been some plans for making build incompatible changes to +> the library API. This is inconvenient, but it is much more so without +> a way to easily conditional build against multiple versions of +> notmuch. +> +> The macro has been lifted from glib. + ++1 + +Tomi + + +> --- +> lib/notmuch.h | 24 ++++++++++++++++++++++++ +> 1 file changed, 24 insertions(+) +> +> diff --git a/lib/notmuch.h b/lib/notmuch.h +> index 9dab555..d109a2c 100644 +> --- a/lib/notmuch.h +> +++ b/lib/notmuch.h +> @@ -41,6 +41,30 @@ NOTMUCH_BEGIN_DECLS +> #define TRUE 1 +> #endif +> +> +#define NOTMUCH_MAJOR_VERSION 0 +> +#define NOTMUCH_MINOR_VERSION 17 +> +#define NOTMUCH_MICRO_VERSION 0 +> + +> +/* +> + * Check the version of the notmuch library being compiled against. +> + * +> + * Return true if the library being compiled against is of the +> + * specified version or above. For example: +> + * +> + * #if NOTMUCH_CHECK_VERSION(0, 18, 0) +> + * (code requiring notmuch 0.18 or above) +> + * #endif +> + * +> + * NOTMUCH_CHECK_VERSION has been defined since version 0.17.0; you +> + * can use #if !defined(NOTMUCH_CHECK_VERSION) to check for versions +> + * prior to that. +> + */ +> +#define NOTMUCH_CHECK_VERSION (major, minor, micro) \ +> + (NOTMUCH_MAJOR_VERSION > (major) || \ +> + (NOTMUCH_MAJOR_VERSION == (major) && NOTMUCH_MINOR_VERSION > (minor)) || \ +> + (NOTMUCH_MAJOR_VERSION == (major) && NOTMUCH_MINOR_VERSION == (minor) && \ +> + NOTMUCH_MICRO_VERSION >= (micro))) +> + +> typedef int notmuch_bool_t; +> +> /* Status codes used for the return values of most functions. +> -- +> 1.8.4.rc3 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch