From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 38EDD6DE10E8 for ; Fri, 6 Jan 2017 12:15:11 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: 0.271 X-Spam-Level: X-Spam-Status: No, score=0.271 tagged_above=-999 required=5 tests=[AWL=0.291, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] 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 Bv9hFnC5CO4o for ; Fri, 6 Jan 2017 12:15:10 -0800 (PST) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by arlo.cworth.org (Postfix) with ESMTPS id 154896DE110A for ; Fri, 6 Jan 2017 12:15:04 -0800 (PST) Received: by mail-lf0-f68.google.com with SMTP id q89so749938lfi.1 for ; Fri, 06 Jan 2017 12:15:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=4f7sGNp9x17qbumgZltbmixyi5tYP/dw2XKOWK2ptOg=; b=odhebRw6hwclsf0tMVB48pkLgqKGAz2okto9KC8GFTTuRcyq293JM7Yk+byk2Lzghx 9qqWGjjxDVmDgANvSsDbz5XIpcviq+Pf7fTEoopIQjlIkeaUpXyAqIXAfQZxvBQeghD4 ZWyBlQclOrtdAGGYLBdE606Q+CO6qS2zajOfBk57UbcmIq/A4tBiAmOqNoZ+5VjCf6tI 8Q2h64GuE9BMPScQkFkkHudkJPogwJwDyXpu8ikgaTLRa+OwM9/6C/bU1V6VlwaVixAB 5CkqF1Fii9wXZLMEPKrts57H5rZtp1xVXzs88ZOFaAmK4zleMzwVPSsaFrqbwIsiabgs OQ5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4f7sGNp9x17qbumgZltbmixyi5tYP/dw2XKOWK2ptOg=; b=Nqhwtdh7kgihT69HHTii30ApMlxzAUSLiexAxTYU6CYI2HVp1CJQ0tdMtcRZJ4euoV Hx+Hre7qYST1pVrOpxCDRyT/MOl+5rrY4iscRWiWTrv7NCuZ+/h/vWLl/s+Q0Viq1OC6 o9ppXSp3pyWddJ5MX4BU8W/6gZw/Qq/ngzgAS3tvonN7e6J3T1txJ1w0VHs82aZ7PTPp q2qxCYSpdLp10LC6REFvFZA9I7VW4apA5dCafK/ngDPn25T+D++0l002tF7bRXOjl2Ld vZ0uKulFIfKgzGI+rv4DWNd7MGvgdPhAUjLM1uuY0hCO92YiHC8tslQULvKD/z3w8L7O z81g== X-Gm-Message-State: AIkVDXIwhDtZhsZmA3NgQunhqtFK5dBVGhRz8lPbZwcYFKCO1Q1R+y3AKdvJY/Bxx9aqng== X-Received: by 10.25.206.204 with SMTP id e195mr13766472lfg.94.1483733701687; Fri, 06 Jan 2017 12:15:01 -0800 (PST) Received: from localhost (dsl-hkibrasgw2-58c367-183.dhcp.inet.fi. [88.195.103.183]) by smtp.gmail.com with ESMTPSA id z2sm19229978lja.10.2017.01.06.12.15.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Jan 2017 12:15:01 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 7/9] cli/show: move formatter structs closer to where they're needed Date: Fri, 6 Jan 2017 22:14:48 +0200 Message-Id: <66c2c311c8d6c22374163c66767d1d356ba97834.1483733461.git.jani@nikula.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Fri, 06 Jan 2017 20:15:11 -0000 The formatter structs are only needed for the formatter array initialization. Move them closer to use. This also lets us drop some forward declarations. No functional changes. --- notmuch-show.c | 67 ++++++++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index bddcb190e4cf..cd16cbf68fe0 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -22,48 +22,6 @@ #include "gmime-filter-reply.h" #include "sprinter.h" -static notmuch_status_t -format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node, - int indent, const notmuch_show_params_t *params); - -static const notmuch_show_format_t format_text = { - .new_sprinter = sprinter_text_create, - .part = format_part_text, -}; - -static notmuch_status_t -format_part_sprinter_entry (const void *ctx, sprinter_t *sp, mime_node_t *node, - int indent, const notmuch_show_params_t *params); - -static const notmuch_show_format_t format_json = { - .new_sprinter = sprinter_json_create, - .part = format_part_sprinter_entry, -}; - -static const notmuch_show_format_t format_sexp = { - .new_sprinter = sprinter_sexp_create, - .part = format_part_sprinter_entry, -}; - -static notmuch_status_t -format_part_mbox (const void *ctx, sprinter_t *sp, mime_node_t *node, - int indent, const notmuch_show_params_t *params); - -static const notmuch_show_format_t format_mbox = { - .new_sprinter = sprinter_text_create, - .part = format_part_mbox, -}; - -static notmuch_status_t -format_part_raw (unused (const void *ctx), sprinter_t *sp, mime_node_t *node, - unused (int indent), - unused (const notmuch_show_params_t *params)); - -static const notmuch_show_format_t format_raw = { - .new_sprinter = sprinter_text_create, - .part = format_part_raw, -}; - static const char * _get_tags_as_string (const void *ctx, notmuch_message_t *message) { @@ -978,6 +936,31 @@ enum { NOTMUCH_FORMAT_RAW }; +static const notmuch_show_format_t format_json = { + .new_sprinter = sprinter_json_create, + .part = format_part_sprinter_entry, +}; + +static const notmuch_show_format_t format_sexp = { + .new_sprinter = sprinter_sexp_create, + .part = format_part_sprinter_entry, +}; + +static const notmuch_show_format_t format_text = { + .new_sprinter = sprinter_text_create, + .part = format_part_text, +}; + +static const notmuch_show_format_t format_mbox = { + .new_sprinter = sprinter_text_create, + .part = format_part_mbox, +}; + +static const notmuch_show_format_t format_raw = { + .new_sprinter = sprinter_text_create, + .part = format_part_raw, +}; + static const notmuch_show_format_t *formatters[] = { [NOTMUCH_FORMAT_JSON] = &format_json, [NOTMUCH_FORMAT_SEXP] = &format_sexp, -- 2.11.0