[Kamailio-Devel] SF.net SVN: openser:[4677] trunk/modules/uri_db/uridb_mod.c
Henning Westerholt
henning.westerholt at 1und1.de
Tue Aug 12 10:17:14 CEST 2008
On Tue, August 12, 2008 10:05 am, Raúl Alexis Betancor Santana wrote:
> I have a doub about uri_db module ... related to bug report 1966153.
>
> Could anyone explain me how the next code runs, from my point of view it's
> wrong if you don't set use_uri_table on the .cfg
>
> if (use_uri_table) {
> /* Check table version */
> ver = uridb_db_ver(&db_url, &db_table);
> if (ver < 0) {
> LM_ERR("Error while querying table version\n");
> goto error;
> } else if (ver != URI_TABLE_VERSION) {
> LM_ERR("Invalid table version of the uri
> table\n");
> goto error;
> }
> } else {
> /* Check table version */
> ver = uridb_db_ver(&db_url, &db_table); <<<<====
> if (ver < 0) {
> LM_ERR("Error while querying table version\n");
> goto error;
> } else if (ver != SUBSCRIBER_TABLE_VERSION) { <<<<====
> LM_ERR("Invalid table version of the subscriber
> table\n");
> goto error;
> }
> }
>
> HOW, in the name of god, is possible that the marked lines runs OK.
Hi Raul,
well, the else case is run if you do not set the use_uri_table, which is
the default. Then it will check the version of the subscriber table, as
the default value for db_table is subscriber. So why do you think it will
not work here? (The code is perhaps a little bit redundant, though.)
> Also, pls remove the "goto error" statements, it's an insult to code
> quality
Ok, what do you suggest for error handling in C then? I also do not like
gotos, but think they are better then code duplication for cleanups and
similar work. But i'll take a look.
Thanks,
Henning
More information about the Devel
mailing list