[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r34975 - trunk/subversion/svn

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Tue, 30 Dec 2008 20:17:16 +0200 (Jerusalem Standard Time)

CArfrever Frehtes Taifersar Arahesis wrote on Mon, 29 Dec 2008 at 20:25
-0800:
> Author: arfrever
> Date: Mon Dec 29 20:25:02 2008
> New Revision: 34975
>
> Log:
> Follow-up to r34967:
> Simplify parsing of argument of '--config-option' option.
>
...
> + if ((equals_sign = strchr(second_colon + 1, '=')) && (equals_sign != second_colon + 1))
> + {
...
> + config_option->file = apr_pcalloc(pool, first_colon - opt_arg);
> + config_option->section = apr_pcalloc(pool, second_colon - first_colon + 1);
> + config_option->option = apr_pcalloc(pool, equals_sign - second_colon + 1);
> + config_option->value = apr_pcalloc(pool, opt_arg + len - equals_sign + 1);

Wow, I'd hate having to do all that +1/-1 arithmetic myself...
</off-topic>

Do you need these pcallocs? (Compare r34968) pstrndup does its own
allocation...

> + config_option->file = apr_pstrndup(pool, opt_arg, first_colon - opt_arg);
> + config_option->section = apr_pstrndup(pool, first_colon + 1, second_colon - first_colon - 1);
> + config_option->option = apr_pstrndup(pool, second_colon + 1, equals_sign - second_colon - 1);

Thanks,

Daniel

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=996145
Received on 2008-12-30 20:12:47 CET

This is an archived mail posted to the Subversion Dev mailing list.