Greg Hudson <ghudson@MIT.EDU> writes:
> Speaking of which, one more itty bitty little tweak I just thought of:
> the argv array is traditionally NULL-terminated as well as counted,
> and we should preserve that property in the copy. This isn't
> particularly time-critical, though.
Done.
> Thanks for committing these changes.
I think you've got the thanker/thankee thing backwards. :-)
-K
> Index: getopt.c
> ===================================================================
> RCS file: /home/cvspublic/apr/misc/unix/getopt.c,v
> retrieving revision 1.26
> diff -u -r1.26 getopt.c
> --- getopt.c 2000/11/25 05:14:59 1.26
> +++ getopt.c 2000/11/25 05:41:48
> @@ -63,9 +63,10 @@
> that's the primary purpose of this function. But people might
> want to use this function with arrays other than the main argv,
> and we shouldn't touch the caller's data. So we copy. */
> - (*os)->argv = apr_palloc(cont, argc * sizeof(const char *));
> + (*os)->argv = apr_palloc(cont, (argc + 1) * sizeof(const char *));
> for (i = 0; i < argc; i++)
> (*os)->argv[i] = argv[i];
> + (*os)->argv[argc] = NULL;
>
> (*os)->interleave = 0;
> (*os)->ind = 1;
Received on Sat Oct 21 14:36:15 2006