Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: 3.1.5-pws-8: setting duplicate elements of assoc array



Sven Wischnowsky writes:
 > 
 > I forgot to tokenize the '{' and '}'. This makes me think that the
 > ctokenize() function should be joined with tokenize() even more,
 > giving tokenize() an extra argument. But I'm reluctant to change every 
 > call to tokenize()...

So don't.  The argument would be the same for almost every existing
instance of tokenize(), right?  Do it this way (no 3.1.5 source code
handy, pardon the psuedo-code):

static void
full_tokenize(char *s, int extra_arg)	/* choose more appropriate name */
{
   /* combined guts of tokenize() and ctokenize() here */
}

/**/
void
tokenize(char *s)
{
   full_tokenize(s, something);
}

/**/
void
ctokenize(char *s)
{
   full_tokenize(s, otherthing);
}

Then change only the calls that actually need the new argument, to
call the new full_tokenize() function.



Messages sorted by: Reverse Date, Date, Thread, Author