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 F0BBC6DE01F6 for ; Fri, 22 Jun 2018 18:42:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-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 IpsgaFDlj2zm for ; Fri, 22 Jun 2018 18:42:55 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 5D9056DE0222 for ; Fri, 22 Jun 2018 18:42:53 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1fWXZj-0002ky-Ri; Fri, 22 Jun 2018 21:42:51 -0400 Received: (nullmailer pid 18046 invoked by uid 1000); Sat, 23 Jun 2018 01:42:49 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 05/12] util/string-map: add _notmuch_string_map_deserialize Date: Fri, 22 Jun 2018 22:42:40 -0300 Message-Id: <20180623014247.17834-6-david@tethera.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180623014247.17834-1-david@tethera.net> References: <20180623014247.17834-1-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.26 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: Sat, 23 Jun 2018 01:42:56 -0000 The anticipated use case is loading the document data area from a message Xapian document into a usable data structure. --- util/string-map.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++ util/string-map.h | 8 ++++++++ 2 files changed, 57 insertions(+) diff --git a/util/string-map.c b/util/string-map.c index ab0c42ab..b29a9ba0 100644 --- a/util/string-map.c +++ b/util/string-map.c @@ -268,3 +268,52 @@ _notmuch_string_map_serialize (void* ctx, notmuch_string_map_t *map) return ret; } + +static char * +unescape_newlines (void *ctx, const char *in, size_t len) { + size_t i,j; + /* removing escapes only makes things shorter */ + char *out = talloc_zero_size (ctx, len+1); + for (i=0, j=0; i