Neil Horman <nhorman@xxxxxxxxxxxxx> writes: > On Thu, Apr 05, 2012 at 01:12:51PM -0700, Junio C Hamano wrote: >> Neil Horman <nhorman@xxxxxxxxxxxxx> writes: >> >> > As a convienience, it would be nice if we could pop entries off the argv_array >> > structs so that if they had multiple uses in a function, we wouldn't have to >> > clear them and repopulate common entries. This patch adds the argv_array_pop >> > function to do just that. Common entries can be added to an argv_array first, >> > then useage specific ones can be added on the end and removed later on. >> > >> > Signed-off-by: Neil Horman <nhorman@xxxxxxxxxxxxx> >> >> >> > CC: Jeff King <peff@xxxxxxxx> >> > CC: Phil Hord <phil.hord@xxxxxxxxx> >> > CC: Junio C Hamano <gitster@xxxxxxxxx> >> > --- >> >> Please don't do "Cc:" here; they belong to your e-mail header. >> > You mean place them below the snip line? I can do that. No. When you review and fix typo in format-patch output, you can add these to the e-mail header part and git-send-email will pick them up just fine. >> If your use case is "After using an argv_array for the first invocation, >> truncate it while keeping the common ones that appear early, so that ones >> that are specific to the second invocation can be pushed", it strikes me >> somewhat odd why you would want to specify "how many to pop". >> > Why? You know you have N common ones. You push some more, perhaps with a sequence of "if (condition) argv_push();" and use it. Now it is time to reprepare it for the second usage. Wouldn't it be more natural to say argv_array_setlen(N); /* start pushing the specific ones for next invocation */ argv_array_push(); if (condition) argv_array_push(); >> > + for(num--; num>0; num--) { >> >> Gaah. >> > Eeek :). If you want something else equally....equal here, please ask for it. > I prefer for loops, but if you would rather have a while loop here, I'm fine > with that. Please look at the existing "for ()" loop in the same file, and then go read the CodingGuidelines. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html