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

Re: [PATCH] set_up_diff_cmd_and_options() doesn't accept NULL config

From: Senthil Kumaran S <senthil_at_collab.net>
Date: Fri, 28 Mar 2008 12:52:18 +0530

Kouhei Sutou wrote:
> set_up_diff_cmd_and_options()'s document says:
>
> /* Initialize DIFF_CMD_BATON.diff_cmd and DIFF_CMD_BATON.options,
> * according to OPTIONS and CONFIG. CONFIG may be null.
> * Allocate the fields in POOL, which should be at least as long-lived
> * as the pool DIFF_CMD_BATON itself is allocated in.
> */
>
> But it doesn't accept NULL as CONFIG.

Can you explain which does not accept NULL as CONFIG?

> - const char *diff_cmd;
> + const char *diff_cmd = NULL;
>
> - /* See if there is a command. */
> - svn_config_t *cfg = apr_hash_get(config, SVN_CONFIG_CATEGORY_CONFIG,
> - APR_HASH_KEY_STRING);
> - svn_config_get(cfg, &diff_cmd, SVN_CONFIG_SECTION_HELPERS,
> - SVN_CONFIG_OPTION_DIFF_CMD, NULL);
> + if (config)
> + {
> + /* See if there is a command. */
> + svn_config_t *cfg = apr_hash_get(config, SVN_CONFIG_CATEGORY_CONFIG,
> + APR_HASH_KEY_STRING);
> + svn_config_get(cfg, &diff_cmd, SVN_CONFIG_SECTION_HELPERS,
> + SVN_CONFIG_OPTION_DIFF_CMD, NULL);
> + }
> +
> diff_cmd_baton->diff_cmd = diff_cmd;

Here you have set diff_cmd as NULL, as per svn_config_get doc "If @a cfg is @c
NULL, just sets @a *valuep to @a default_value." So in this case when the if
condition is not executed, then diff_cmd stays as NULL and there is no default
value set as per svn_config_get's doc.

Am I missing something here?

-- 
Senthil Kumaran S
http://www.stylesen.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-03-28 08:22:52 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.