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 9FE876DE0C1B for ; Thu, 18 May 2017 15:25:49 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.069 X-Spam-Level: X-Spam-Status: No, score=-0.069 tagged_above=-999 required=5 tests=[AWL=-0.048, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] 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 nSEE9EFVZKKN for ; Thu, 18 May 2017 15:25:48 -0700 (PDT) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id CACFD6DE0115 for ; Thu, 18 May 2017 15:25:44 -0700 (PDT) Received: by mail-wm0-f65.google.com with SMTP id v4so14313233wmb.2 for ; Thu, 18 May 2017 15:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=4oIPOvcdzfIsJlY6YZbOSE548T9Mqua1cpkKOmhG+b0=; b=AxrMOulCOu78g8MIXyhUVMus5M4YMbJ6HCTBenfVYtXfbbwVJs3x2HeNc6q2od1rTX NV5CrG0jtGs5j1QnZkDJr8p+DUw4ealu9+aRCBG1NSLUzp0i6Ane0rs5U3C0mfIPw0bT sBmvgPhShBdrMTEFv6jf5VolFnGEve3WYWSyp56IgUshY6Y7XMD+qEj/HHPtG3vi+vrN SneSmuIg8bs/HheT1nSZSCnM8E+L1AxclgMLwAnGaj5wvghy7LfC79tsBqukVfcL+a8Z pWxoYfCZuaM7N01ub4lOu9M3oiBkhDhLWicxIw7+dGfT0CxCblpGhE7PolsxQO2lBXRs S34Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=4oIPOvcdzfIsJlY6YZbOSE548T9Mqua1cpkKOmhG+b0=; b=pARXKpajtWFSL7CFtqryq/uUf6L8q1aSldVhdEuqqzFp2YnxoQOONBrDJ8O52BX1Nt piVjzNj+0obvOGioWfw50fF0ytBo1TDccZw5ubefFQ/OycNRmjj1WRtsFkm8kiIssKzc uTK8WebI+xgUK2ANEVmGyqf1iV1yqNSnt2+552O/4PtHhnTICfSw3yWRM0TWetRZXsdq ODu5Qfaj3Bu7oGh/f0ggpwT4sad2oQZ48xtFn6t3yDyPp2r5YeCNJ4SV084kNkVT1BIA EOAbQWsQ6HKq1pfYHy5dfDWzJspsN20DDj8WIN+FJ0Ng6qLPsivHRbdDgsAlycg+Mk4s lQ1Q== X-Gm-Message-State: AODbwcDB72v76Mgfvuxath+GobW3Im8jf2d5lGdLDYkIV6iuNgPB+U+W M4rY6CNQiga8XXmwAG8= X-Received: by 10.28.35.8 with SMTP id j8mr4155230wmj.96.1495146343287; Thu, 18 May 2017 15:25:43 -0700 (PDT) Received: from adiPC.adirat.com ([82.137.23.239]) by smtp.gmail.com with ESMTPSA id q16sm8141390wmg.2.2017.05.18.15.25.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 15:25:42 -0700 (PDT) From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH v2 06/11] sprinter: add unsigned_long printer function Date: Fri, 19 May 2017 01:27:03 +0300 Message-Id: <20170518222708.30032-7-adi@adirat.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170518222708.30032-1-adi@adirat.com> References: <20170518222708.30032-1-adi@adirat.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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, 18 May 2017 22:25:49 -0000 We need to output unsigned long values for message and thread (sum of all message's) file sizes. Signed-off-by: Ioan-Adrian Ratiu --- sprinter-json.c | 9 +++++++++ sprinter-sexp.c | 9 +++++++++ sprinter-text.c | 9 +++++++++ sprinter.h | 1 + 4 files changed, 28 insertions(+) diff --git a/sprinter-json.c b/sprinter-json.c index 0a077907..de1dbec2 100644 --- a/sprinter-json.c +++ b/sprinter-json.c @@ -132,6 +132,14 @@ json_integer (struct sprinter *sp, int val) } static void +json_unsigned_long (struct sprinter *sp, unsigned long val) +{ + struct sprinter_json *spj = json_begin_value (sp); + + fprintf (spj->stream, "%lu", val); +} + +static void json_boolean (struct sprinter *sp, notmuch_bool_t val) { struct sprinter_json *spj = json_begin_value (sp); @@ -181,6 +189,7 @@ sprinter_json_create (const void *ctx, FILE *stream) .string = json_string, .string_len = json_string_len, .integer = json_integer, + .unsigned_long = json_unsigned_long, .boolean = json_boolean, .null = json_null, .map_key = json_map_key, diff --git a/sprinter-sexp.c b/sprinter-sexp.c index 08783e11..3162ad9c 100644 --- a/sprinter-sexp.c +++ b/sprinter-sexp.c @@ -169,6 +169,14 @@ sexp_integer (struct sprinter *sp, int val) } static void +sexp_unsigned_long (struct sprinter *sp, unsigned long val) +{ + struct sprinter_sexp *sps = sexp_begin_value (sp); + + fprintf (sps->stream, "%lu", val); +} + +static void sexp_boolean (struct sprinter *sp, notmuch_bool_t val) { struct sprinter_sexp *sps = sexp_begin_value (sp); @@ -216,6 +224,7 @@ sprinter_sexp_create (const void *ctx, FILE *stream) .string = sexp_string, .string_len = sexp_string_len, .integer = sexp_integer, + .unsigned_long = sexp_unsigned_long, .boolean = sexp_boolean, .null = sexp_null, .map_key = sexp_map_key, diff --git a/sprinter-text.c b/sprinter-text.c index 7779488f..5d1607e9 100644 --- a/sprinter-text.c +++ b/sprinter-text.c @@ -52,6 +52,14 @@ text_integer (struct sprinter *sp, int val) } static void +text_unsigned_long (struct sprinter *sp, unsigned long val) +{ + struct sprinter_text *sptxt = (struct sprinter_text *) sp; + + fprintf (sptxt->stream, "%lu", val); +} + +static void text_boolean (struct sprinter *sp, notmuch_bool_t val) { struct sprinter_text *sptxt = (struct sprinter_text *) sp; @@ -123,6 +131,7 @@ sprinter_text_create (const void *ctx, FILE *stream) .string = text_string, .string_len = text_string_len, .integer = text_integer, + .unsigned_long = text_unsigned_long, .boolean = text_boolean, .null = text_null, .map_key = text_map_key, diff --git a/sprinter.h b/sprinter.h index f859672f..2495a7d1 100644 --- a/sprinter.h +++ b/sprinter.h @@ -34,6 +34,7 @@ typedef struct sprinter { void (*string) (struct sprinter *, const char *); void (*string_len) (struct sprinter *, const char *, size_t); void (*integer) (struct sprinter *, int); + void (*unsigned_long) (struct sprinter *, unsigned long); void (*boolean) (struct sprinter *, notmuch_bool_t); void (*null) (struct sprinter *); -- 2.13.0