From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Tue, 14 Jan 2014 21:59:40 +0000 Subject: [PATCH] filter: refactor cgit_new_filter() In-Reply-To: References: <1389704448-18829-1-git-send-email-Jason@zx2c4.com> <20140114203939.GB7608@serenity.lan> Message-ID: <20140114215940.GC7608@serenity.lan> On Tue, Jan 14, 2014 at 09:54:21PM +0100, Jason A. Donenfeld wrote: > On Tue, Jan 14, 2014 at 9:39 PM, John Keeping wrote: > > I like the simplification, but I'm not sure the result is better. Even > > without the rest we should replace the strncmp with prefixcmp though. > > Agreed. > > > > There's actually no reason we couldn't mutate "cmd" here, which would > > simplify it a lot, but I'm not sure we want to remove the const > > modifiers all the way through. Then we can just do "*colon = '\0'" and > > use strcmp. > > IMHO, it's better to keep lookup tables like these in the read-only > section. Let's keep the constness. I meant for the input, which is read from the config file. Just terminate the user-specified command string at the colon and treat it as two genuinely separate strings.