From mboxrd@z Thu Jan 1 00:00:00 1970 From: andy at warmcat.com (Andy Green) Date: Tue, 19 Jun 2018 16:38:10 +0800 Subject: [PATCH v2 12/15] ui-tree: render any matching README file in tree view In-Reply-To: <20180619083113.GV1922@john.keeping.me.uk> References: <152928998685.10419.7869045561776063625.stgit@mail.warmcat.com> <152929069579.10419.11978742686135883967.stgit@mail.warmcat.com> <20180618193613.GU1922@john.keeping.me.uk> <0fea8736-a55c-3306-4185-7b0424119a43@warmcat.com> <20180619083113.GV1922@john.keeping.me.uk> Message-ID: <800ba76f-64c3-bc90-1014-1c732efbea53@warmcat.com> On 06/19/2018 04:31 PM, John Keeping wrote: >>> We can lose a level of indentation here by writing it as: >>> >>> if (render) >>> ... >>> else if (mimetype) >>> ... >>> else >>> ... >> >> OK. Actually this was a modified cut-n-paste from your patch's >> implementation in print_object(). So I also changed that code to follow >> this scheme. >> >> if (use_render) { >> if (render) >> render_buffer(render, basename, buf, size); >> else >> include_file(path, mimetype); >> } else { >> print_buffer(basename, buf, size); >> } >> >> became >> >> if (!use_render) >> print_buffer(basename, buf, size); >> else if (render) >> render_buffer(render, basename, buf, size); >> else >> include_file(path, mimetype); > > I think the point is that the logic is different, in that this version > effectively has use_render always true, whereas the version in > print_object() must allow the caller to disable render/mimetype handling > even if those variables are non-null. > > It's personal taste, but I think the positive logic is clearer to read. OK... -Andy