You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@gmail.com> on 2009/01/21 20:04:53 UTC

Re: svn commit: r35379 - in trunk/subversion: include/private libsvn_fs_fs libsvn_subr

On Wed, Jan 21, 2009 at 19:52, Hyrum K. Wright <hy...@hyrumwright.org> wrote:
>...
> +++ trunk/subversion/libsvn_subr/sqlite.c       Wed Jan 21 10:52:27 2009        (r35379)
> @@ -50,6 +50,10 @@ sqlite_tracer(void *data, const char *sq
>  struct svn_sqlite__db_t
>  {
>   sqlite3 *db3;
> +  const char **statement_strings;

You changed this decl in a later revision to:

  const char * const *statement_strings;

but the argument uses [] ... maybe do the same here?

>...
>  svn_error_t *
> +svn_sqlite__get_statement(svn_sqlite__stmt_t **stmt, svn_sqlite__db_t *db,
> +                          int stmt_idx)
> +{
> +  if (db->prepared_stmts[stmt_idx] == NULL)
> +    SVN_ERR(svn_sqlite__prepare(&db->prepared_stmts[stmt_idx], db,
> +                                db->statement_strings[stmt_idx], db->pool));

Before the if, maybe add:

  SVN_ERR_ASSERT(stmt_idx < db->nbr_statements);


Cheers,
-g

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1041930

Re: svn commit: r35379 - in trunk/subversion: include/private libsvn_fs_fs libsvn_subr

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
Greg Stein wrote:
> On Wed, Jan 21, 2009 at 19:52, Hyrum K. Wright <hy...@hyrumwright.org> wrote:
>> ...
>> +++ trunk/subversion/libsvn_subr/sqlite.c       Wed Jan 21 10:52:27 2009        (r35379)
>> @@ -50,6 +50,10 @@ sqlite_tracer(void *data, const char *sq
>>  struct svn_sqlite__db_t
>>  {
>>   sqlite3 *db3;
>> +  const char **statement_strings;
> 
> You changed this decl in a later revision to:
> 
>   const char * const *statement_strings;
> 
> but the argument uses [] ... maybe do the same here?

I tried, but the compiler wasn't too happy.  We need to assign this variable, 
and I don't think that an array name can be used as an lvalue.

>> ...
>>  svn_error_t *
>> +svn_sqlite__get_statement(svn_sqlite__stmt_t **stmt, svn_sqlite__db_t *db,
>> +                          int stmt_idx)
>> +{
>> +  if (db->prepared_stmts[stmt_idx] == NULL)
>> +    SVN_ERR(svn_sqlite__prepare(&db->prepared_stmts[stmt_idx], db,
>> +                                db->statement_strings[stmt_idx], db->pool));
> 
> Before the if, maybe add:
> 
>   SVN_ERR_ASSERT(stmt_idx < db->nbr_statements);

Ah, good idea. r35382.

-Hyrum

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1041968