[Asterisk-code-review] Change in asterisk[master]: cel_pgsql: Fix schema query for get columns name

Rodrigo Ramirez Norambuena (Code Review) asteriskteam at digium.com
Sun Apr 19 13:54:19 CDT 2015


Rodrigo Ramirez Norambuena has posted comments on this change.

Change subject: cel_pgsql: Fix schema query for get columns name
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.asterisk.org/#/c/120/1/cel/cel_pgsql.c
File cel/cel_pgsql.c:

Line 562: 			/* Escape special characters in schemaname */
        : 			if (strchr(schemaname, '\\') || strchr(schemaname, '\'')) {
        : 				char *tmp = schemaname, *ptr;
        : 
        : 				ptr = schemaname = ast_alloca(strlen(tmp) * 2 + 1);
        : 				for (; *tmp; tmp++) {
        : 					if (strchr("\\'", *tmp)) {
        : 						*ptr++ = *tmp;
        : 					}
        : 					*ptr++ = *tmp;
        : 				}
        : 				*ptr = '\0';
        : 			}
        : 			/* Escape special characters in tablename */
        : 			if (strchr(tablename, '\\') || strchr(tablename, '\'')) {
        : 				char *tmp = tablename, *ptr;
        : 
        : 				ptr = tablename = ast_alloca(strlen(tmp) * 2 + 1);
        : 				for (; *tmp; tmp++) {
        : 					if (strchr("\\'", *tmp)) {
        : 						*ptr++ = *tmp;
        : 					}
        : 					*ptr++ = *tmp;
        : 				}
        : 				*ptr = '\0';
        : 			}
> These two sections are exactly the same except for the fact that one operat
Where is do you thinks is the best place for this function?, 

I ask because the cdr/cdr_pgsql.c have the same repetead code and if generate a function i thinks the best way is the other code (cdr/cdr_pgsql.c)  to will use the same function in a refactor code after.


-- 
To view, visit https://gerrit.asterisk.org/120
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I691fd2cbc277fcba10e615f5884f8de5d8152f2c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list