From: Jani Nikula Date: Thu, 5 Apr 2012 12:00:50 +0000 (+0000) Subject: Re: [PATCH 3/8] hex-escape: add function to decode escaped string in-place X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f4951c5d7162f7d28a6b29747c60b83aeb95aa0d;p=notmuch-archives.git Re: [PATCH 3/8] hex-escape: add function to decode escaped string in-place --- diff --git a/c4/9206ee088acb93f72b2c7ce26deb32614efa95 b/c4/9206ee088acb93f72b2c7ce26deb32614efa95 new file mode 100644 index 000000000..e3df02048 --- /dev/null +++ b/c4/9206ee088acb93f72b2c7ce26deb32614efa95 @@ -0,0 +1,123 @@ +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 6CF13431FB6 + for ; Thu, 5 Apr 2012 05:00:55 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 Y-xrZIb6WdM6 for ; + Thu, 5 Apr 2012 05:00:55 -0700 (PDT) +Received: from mail-qa0-f43.google.com (mail-qa0-f43.google.com + [209.85.216.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D4DDC431FAE + for ; Thu, 5 Apr 2012 05:00:54 -0700 (PDT) +Received: by qadb15 with SMTP id b15so1348954qad.2 + for ; Thu, 05 Apr 2012 05:00:54 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type:x-gm-message-state; + bh=Y+C/Ja8vCfqWISx60fFzLBTn+WOXMgIEwbf1mA7QvjM=; + b=H9Ie8/+exKiLQO9Vwkj+w4Omewg9H7mkbnkPhzUVfT5ba5XRfs7p6Ru5b2X+H5JGjv + l5eG74KNd1luQ+f4egdV8iCbESudQyPC9msXFFQtrT0AC42dkWWQDqhXHDhEFhTfy0qr + /fvtxTQJZdnjuO1XaGGyEo4K7PjQJGMs/jZ1kf54RGPCBuj+Rf4odcWKZgEBXjr9nAw4 + XZ5OCzY6PB+CxRvfDLhhQFjkc9JhLdFYvNlPql87Sfz8s8PGCsCtq4GluDmqlyXBx/eZ + e33y8NY9rb9aOJblBHvi3MjpAiqOl4trkWdXr+CwjS+Saa5tIG3R11P2rC70K66+3nCa + U46w== +Received: by 10.224.35.130 with SMTP id p2mr3582239qad.32.1333627254129; + Thu, 05 Apr 2012 05:00:54 -0700 (PDT) +Received: from localhost (nikula.org. [92.243.24.172]) + by mx.google.com with ESMTPS id ha3sm5817040qab.13.2012.04.05.05.00.51 + (version=SSLv3 cipher=OTHER); Thu, 05 Apr 2012 05:00:52 -0700 (PDT) +From: Jani Nikula +To: David Bremner , notmuch@notmuchmail.org +Subject: Re: [PATCH 3/8] hex-escape: add function to decode escaped string + in-place +In-Reply-To: <87d37mtms7.fsf@zancas.localnet> +References: + <026815054d3e01e6f29c0834d43ccabdf6eda481.1333231401.git.jani@nikula.org>User-Agent: Notmuch/0.12+70~g46e73fe (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) <87d37mtms7.fsf@zancas.localnet> +User-Agent: Notmuch/0.11.1+222~ga47a98c (http://notmuchmail.org) Emacs/23.1.1 + (i686-pc-linux-gnu) +Date: Thu, 05 Apr 2012 12:00:50 +0000 +Message-ID: <87ehs2xua5.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Gm-Message-State: + ALoCoQmWDVbyz/nM7YU1sWTV6xZM34L0J7Mr9Apv+e2PWBTvDq25MF65Rtj8yXKIl1NeW33qv9w5 +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, 05 Apr 2012 12:00:55 -0000 + + +Thanks for the review, David. Agreed on all points. + +J. + + +On Thu, 05 Apr 2012 08:56:24 -0300, David Bremner wrote: +> Jani Nikula writes: +> +> > Add function hex_decode_inplace() to decode the input string onto +> > itself. +> > +> > Signed-off-by: Jani Nikula +> > +> > --- +> > +> > This could be folded to "hex-escape: (en|de)code strings to/from +> > restricted character set". +> +> Probably. It's a bit hard to follow as is; somehow the code movement is +> a bit noisy. +> +> > while (*p) { +> > - +> > if (*p == escape_char) { +> > - +> unrelated whitespace changes, naughty naughty. +> +> > +hex_status_t +> > +hex_decode_inplace (char *p) +> > +{ +> > + return hex_decode_internal (p, (unsigned char *) p); +> this could probably use a comment to the effect that there _will_ be +> enough space. +> +> > + +> > + p = in; +> > + q = (unsigned char *) *out; +> +> I understand trying to minimize changes, but do p and q serve any +> purpose here? +> +> > + +> > + return hex_decode_internal (p, q); +> > +} +> +> +> > +/* +> > + * Decode 'in' onto itself. +> > + */ +> +> This is just a bit terse for my taste. +> +> d