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 74BC96DE0314 for ; Tue, 23 May 2017 09:53:17 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.154 X-Spam-Level: X-Spam-Status: No, score=-0.154 tagged_above=-999 required=5 tests=[AWL=-0.134, 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] 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 MaRosdxCYsaL for ; Tue, 23 May 2017 09:53:16 -0700 (PDT) Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by arlo.cworth.org (Postfix) with ESMTPS id 1132D6DE0191 for ; Tue, 23 May 2017 09:53:16 -0700 (PDT) Received: by mail-lf0-f66.google.com with SMTP id h4so8769698lfj.3 for ; Tue, 23 May 2017 09:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=Uh2KNKipMk/KUXi4rby6jMiKBpnRIWLg0+pJkoAEUrA=; b=xFNi9Ut/TloJuHtM5eEJZuXIS7zsQ8vGVBUmf6GUFohkoXYeElXA++sO/bfExKph3S U15927rTp5NtVwv9RgJcwOLOS7zZqeXVepysz8Wf43JL+h5g7B4CzKf+v1q6Kmows7Zb G/wzYYxPt27hd0r+op8Io4yhpBES3X4YJOvr7TyQBAXEctuTHqYqL8AvZKBcPL9cnpFn wuL+0p8No2Tw07/5LQge71WcXhV83lAkaDuW9izLWVuamA6UjCovbh7IFAjYnSKpJ7by ON2zfLkDDJ9yQcJb3l3XCiYF98X1bviXOPg3rA0g1NT9YEWAmSwqZoAAZkCoe8fKKubY mptQ== 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:in-reply-to:references:date :message-id:mime-version; bh=Uh2KNKipMk/KUXi4rby6jMiKBpnRIWLg0+pJkoAEUrA=; b=J4JgK8CRVL9eAX+mUmXT/gYAhzPxVdWdaoSdDdTp/PcxDc9lW4zVcI/9n4vS+YmQCM qlNrzkSLmYgEylHW4iqJC+nRvwm/O4QRuXOW39Oi6167z2hAAxU23Ru9/kJmrs1V+WNk P+Xoone2iAsw/MuuisBtIHxFcZtBAHkCmBWQxyO5OXJSiJJppH0DWTpQ4aLRRVY+CZfL ZodGtaa4bey5KJTuB/CsbtbSON2GsK6ggWUpacNAgxBruvg3ECk5z0s5UYQ30NdXReWm /NPBGot/Hnm8yJ8wLPVldv4KoWbSwfqJZDAT7IDEpgo4RpIXsKOTwTnWoRnQ9eFlWa53 JiaQ== X-Gm-Message-State: AODbwcCQ3oxf0DS3s2s98KY2X9DlRbQW+C3jkL3A/k9aA5GKif+8Yn9F YZhpYpctogpjnfoGLnm00w== X-Received: by 10.46.82.85 with SMTP id g82mr8037101ljb.68.1495558394453; Tue, 23 May 2017 09:53:14 -0700 (PDT) Received: from localhost (mobile-access-bcee7f-185.dhcp.inet.fi. [188.238.127.185]) by smtp.gmail.com with ESMTPSA id f82sm269690lff.40.2017.05.23.09.53.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 May 2017 09:53:13 -0700 (PDT) From: Jani Nikula To: Ioan-Adrian Ratiu , notmuch@notmuchmail.org Subject: Re: [PATCH v2 06/11] sprinter: add unsigned_long printer function In-Reply-To: <20170518222708.30032-7-adi@adirat.com> References: <20170518222708.30032-1-adi@adirat.com> <20170518222708.30032-7-adi@adirat.com> Date: Tue, 23 May 2017 19:53:12 +0300 Message-ID: <87tw4ba51j.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain 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: Tue, 23 May 2017 16:53:17 -0000 On Fri, 19 May 2017, Ioan-Adrian Ratiu wrote: > We need to output unsigned long values for message and thread > (sum of all message's) file sizes. The sprinter types should be about the types that can be represented using the format being output, i.e. JSON and S-Expressions, *not* about the C types. I'd rather see the integer sprinter functions expanded to a bigger type. BR, Jani. > > 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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch