Skip to content

Commit

Permalink
和文档统一参数命名
Browse files Browse the repository at this point in the history
  • Loading branch information
chiyou committed Jul 23, 2014
1 parent 5dc92c5 commit 556fc55
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion routes/yaf_route_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ YAF_BEGIN_ARG_INFO_EX(yaf_route_route_arginfo, 0, 0, 1)
YAF_END_ARG_INFO()

YAF_BEGIN_ARG_INFO_EX(yaf_route_assemble_arginfo, 0, 0, 1)
YAF_ARG_ARRAY_INFO(0, mvc, 0)
YAF_ARG_ARRAY_INFO(0, info, 0)
YAF_ARG_ARRAY_INFO(0, query, 1)
YAF_END_ARG_INFO()

Expand Down
16 changes: 8 additions & 8 deletions routes/yaf_route_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ PHP_METHOD(yaf_route_map, route) {
}
/* }}} */

/** {{{ zval * yaf_route_map_assemble(zval *mvc, zval *query TSRMLS_DC)
/** {{{ zval * yaf_route_map_assemble(zval *info, zval *query TSRMLS_DC)
*/
zval * yaf_route_map_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query TSRMLS_DC) {
zval * yaf_route_map_assemble(yaf_route_t *this_ptr, zval *info, zval *query TSRMLS_DC) {
char *tmp, *ptrptr, *pname;
smart_str tvalue = {0};
uint tmp_len, has_delim = 0;
Expand All @@ -174,14 +174,14 @@ zval * yaf_route_map_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query TSRM

do {
if (Z_BVAL_P(ctl_prefer)) {
if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp_data) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp_data) == SUCCESS) {
pname = estrndup(Z_STRVAL_PP(tmp_data), Z_STRLEN_PP(tmp_data));
} else {
yaf_trigger_error(YAF_ERR_TYPE_ERROR TSRMLS_CC, "%s", "Undefined the 'action' parameter for the 1st parameter");
break;
}
} else {
if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp_data) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp_data) == SUCCESS) {
pname = estrndup(Z_STRVAL_PP(tmp_data), Z_STRLEN_PP(tmp_data));
} else {
yaf_trigger_error(YAF_ERR_TYPE_ERROR TSRMLS_CC, "%s", "Undefined the 'controller' parameter for the 1st parameter");
Expand Down Expand Up @@ -268,16 +268,16 @@ PHP_METHOD(yaf_route_map, __construct) {
}
/* }}} */

/** {{{ proto public Yaf_Route_Map::assemble(array $mvc[, array $query = NULL])
/** {{{ proto public Yaf_Route_Map::assemble(array $info[, array $query = NULL])
*/
PHP_METHOD(yaf_route_map, assemble) {
zval *mvc, *query;
zval *info, *query;
zval *return_uri;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &mvc, &query) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &info, &query) == FAILURE) {
return;
} else {
if ((return_uri = yaf_route_map_assemble(getThis(), mvc, query TSRMLS_CC))) {
if ((return_uri = yaf_route_map_assemble(getThis(), info, query TSRMLS_CC))) {
RETURN_ZVAL(return_uri, 0, 1);
}
}
Expand Down
18 changes: 9 additions & 9 deletions routes/yaf_route_regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ static zval * yaf_route_regex_match(yaf_route_t *route, char *uri, int len TSRML
}
/* }}} */

/** {{{ zval * yaf_route_regex_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query TSRMLS_DC)
/** {{{ zval * yaf_route_regex_assemble(yaf_route_t *this_ptr, zval *info, zval *query TSRMLS_DC)
*/
zval * yaf_route_regex_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query TSRMLS_DC) {
zval * yaf_route_regex_assemble(yaf_route_t *this_ptr, zval *info, zval *query TSRMLS_DC) {
zval *reverse, *uri;
zval **tmp;
char *tstr, *inter;
Expand All @@ -174,19 +174,19 @@ zval * yaf_route_regex_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query TS
tstr = estrndup(Z_STRVAL_P(reverse), Z_STRLEN_P(reverse));
tlen = Z_STRLEN_P(reverse);

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), (void **)&tmp) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), (void **)&tmp) == SUCCESS) {
inter = php_str_to_str(tstr, tlen, ZEND_STRL(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &tlen);
efree(tstr);
tstr = inter;
}

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp) == SUCCESS) {
inter = php_str_to_str(tstr, tlen, ZEND_STRL(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &tlen);
efree(tstr);
tstr = inter;
}

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp) == SUCCESS) {
inter = php_str_to_str(tstr, tlen, ZEND_STRL(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &tlen);
efree(tstr);
tstr = inter;
Expand Down Expand Up @@ -356,15 +356,15 @@ PHP_METHOD(yaf_route_regex, __construct) {
}
/** }}} */

/** {{{ proto public Yaf_Route_regex::assemble(array $mvc[, array $query = NULL])
/** {{{ proto public Yaf_Route_regex::assemble(array $info[, array $query = NULL])
*/
PHP_METHOD(yaf_route_regex, assemble) {
zval *mvc, *query, *return_uri = NULL;
zval *info, *query, *return_uri = NULL;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &mvc, &query) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &info, &query) == FAILURE) {
return;
} else {
if ((return_uri = yaf_route_regex_assemble(getThis(), mvc, query TSRMLS_CC))) {
if ((return_uri = yaf_route_regex_assemble(getThis(), info, query TSRMLS_CC))) {
RETURN_ZVAL(return_uri, 0, 1);
}
}
Expand Down
16 changes: 8 additions & 8 deletions routes/yaf_route_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ PHP_METHOD(yaf_route_rewrite, route) {
}
/** }}} */

/** {{{ zval * yaf_route_rewrite_assemble(yaf_route_t *this_ptr, zval *idents, zval *query TSRMLS_DC)
/** {{{ zval * yaf_route_rewrite_assemble(yaf_route_t *this_ptr, zval *info, zval *query TSRMLS_DC)
*/
zval * yaf_route_rewrite_assemble(yaf_route_t *this_ptr, zval *idents, zval *query TSRMLS_DC) {
zval * yaf_route_rewrite_assemble(yaf_route_t *this_ptr, zval *info, zval *query TSRMLS_DC) {
zval *uri, *match, *pidents;
zval **tmp;
char *tstr, *inter, *seg, *pmatch, *ptrptr, *key;
Expand All @@ -287,7 +287,7 @@ zval * yaf_route_rewrite_assemble(yaf_route_t *this_ptr, zval *idents, zval *que
pmatch = estrndup(Z_STRVAL_P(match), Z_STRLEN_P(match));
tstr = estrndup(Z_STRVAL_P(match), Z_STRLEN_P(match));
tlen = Z_STRLEN_P(match);
zend_hash_copy(Z_ARRVAL_P(pidents), Z_ARRVAL_P(idents), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
zend_hash_copy(Z_ARRVAL_P(pidents), Z_ARRVAL_P(info), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));

seg = php_strtok_r(pmatch, YAF_ROUTER_URL_DELIMIETER, &ptrptr);
while (seg) {
Expand Down Expand Up @@ -315,7 +315,7 @@ zval * yaf_route_rewrite_assemble(yaf_route_t *this_ptr, zval *idents, zval *que
}

if(*(seg) == ':') {
if (zend_hash_find(Z_ARRVAL_P(idents), seg, seg_len + 1, (void **)&tmp) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), seg, seg_len + 1, (void **)&tmp) == SUCCESS) {
inter = php_str_to_str(tstr, tlen, seg, seg_len, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &tlen);
efree(tstr);
tstr = inter;
Expand Down Expand Up @@ -418,15 +418,15 @@ PHP_METHOD(yaf_route_rewrite, __construct) {
}
/** }}} */

/** {{{ proto public Yaf_Route_rewrite::assemble(array $idents[, array $query = NULL])
/** {{{ proto public Yaf_Route_rewrite::assemble(array $info[, array $query = NULL])
*/
PHP_METHOD(yaf_route_rewrite, assemble) {
zval *idents, *query, *return_uri = NULL;
zval *info, *query, *return_uri = NULL;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &idents, &query) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &info, &query) == FAILURE) {
return;
} else {
if ((return_uri = yaf_route_rewrite_assemble(getThis(), idents, query TSRMLS_CC))) {
if ((return_uri = yaf_route_rewrite_assemble(getThis(), info, query TSRMLS_CC))) {
RETURN_ZVAL(return_uri, 0, 1);
}
}
Expand Down
18 changes: 9 additions & 9 deletions routes/yaf_route_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ PHP_METHOD(yaf_route_simple, route) {
}
/* }}} */

/** {{{ zval * yaf_route_simple_assemble(zval *mvc, zval *query TSRMLS_DC)
/** {{{ zval * yaf_route_simple_assemble(zval *info, zval *query TSRMLS_DC)
*/
zval * yaf_route_simple_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query TSRMLS_DC) {
zval * yaf_route_simple_assemble(yaf_route_t *this_ptr, zval *info, zval *query TSRMLS_DC) {
smart_str tvalue = {0};
zval *nmodule, *ncontroller, *naction;
zval *uri;
Expand All @@ -124,14 +124,14 @@ zval * yaf_route_simple_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query T
do {
zval **tmp;

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), (void **)&tmp) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), (void **)&tmp) == SUCCESS) {
smart_str_appendl(&tvalue, Z_STRVAL_P(nmodule), Z_STRLEN_P(nmodule));
smart_str_appendc(&tvalue, '=');
smart_str_appendl(&tvalue, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
smart_str_appendc(&tvalue, '&');
}

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp) == FAILURE) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp) == FAILURE) {
yaf_trigger_error(YAF_ERR_TYPE_ERROR TSRMLS_CC, "%s", "You need to specify the controller by ':c'");
break;
}
Expand All @@ -141,7 +141,7 @@ zval * yaf_route_simple_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query T
smart_str_appendl(&tvalue, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
smart_str_appendc(&tvalue, '&');

if(zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp) == FAILURE) {
if(zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp) == FAILURE) {
yaf_trigger_error(YAF_ERR_TYPE_ERROR TSRMLS_CC, "%s", "You need to specify the action by ':a'");
break;
}
Expand Down Expand Up @@ -203,16 +203,16 @@ PHP_METHOD(yaf_route_simple, __construct) {
}
/* }}} */

/** {{{ proto public Yaf_Route_Simple::assemble(array $mvc[, array $query = NULL])
/** {{{ proto public Yaf_Route_Simple::assemble(array $info[, array $query = NULL])
*/
PHP_METHOD(yaf_route_simple, assemble) {
zval *mvc, *query;
zval *info, *query;
zval *return_uri;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &mvc, &query) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &info, &query) == FAILURE) {
return;
} else {
if ((return_uri = yaf_route_simple_assemble(getThis(), mvc, query TSRMLS_CC))) {
if ((return_uri = yaf_route_simple_assemble(getThis(), info, query TSRMLS_CC))) {
RETURN_ZVAL(return_uri, 0, 1);
}
}
Expand Down
18 changes: 9 additions & 9 deletions routes/yaf_route_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ int yaf_route_static_route(yaf_route_t *route, yaf_request_t *request TSRMLS_DC)
}
/* }}} */

/** {{{ zval * yaf_route_static_assemble(zval *mvc, zval *query TSRMLS_DC)
/** {{{ zval * yaf_route_static_assemble(zval *info, zval *query TSRMLS_DC)
*/
zval * yaf_route_static_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query TSRMLS_DC) {
zval * yaf_route_static_assemble(yaf_route_t *this_ptr, zval *info, zval *query TSRMLS_DC) {
smart_str tvalue = {0};
zval *uri;

Expand All @@ -190,20 +190,20 @@ zval * yaf_route_static_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query T
do {
zval **tmp;

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), (void **)&tmp) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), (void **)&tmp) == SUCCESS) {
smart_str_appendc(&tvalue, '/');
smart_str_appendl(&tvalue, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
}

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp) == FAILURE) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp) == FAILURE) {
yaf_trigger_error(YAF_ERR_TYPE_ERROR TSRMLS_CC, "%s", "You need to specify the controller by ':c'");
break;
}

smart_str_appendc(&tvalue, '/');
smart_str_appendl(&tvalue, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));

if(zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp) == FAILURE) {
if(zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp) == FAILURE) {
yaf_trigger_error(YAF_ERR_TYPE_ERROR TSRMLS_CC, "%s", "You need to specify the action by ':a'");
break;
}
Expand Down Expand Up @@ -272,16 +272,16 @@ PHP_METHOD(yaf_route_static, match) {
}
/* }}} */

/** {{{ proto public Yaf_Route_Static::assemble(array $mvc[, array $query = NULL])
/** {{{ proto public Yaf_Route_Static::assemble(array $info[, array $query = NULL])
*/
PHP_METHOD(yaf_route_static, assemble) {
zval *mvc, *query;
zval *info, *query;
zval *return_uri;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &mvc, &query) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &info, &query) == FAILURE) {
return;
} else {
if ((return_uri = yaf_route_static_assemble(getThis(), mvc, query TSRMLS_CC))) {
if ((return_uri = yaf_route_static_assemble(getThis(), info, query TSRMLS_CC))) {
RETURN_ZVAL(return_uri, 0, 1);
}
}
Expand Down
18 changes: 9 additions & 9 deletions routes/yaf_route_supervar.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ PHP_METHOD(yaf_route_supervar, route) {
}
/** }}} */

/** {{{ zval * yaf_route_supervar_assemble(zval *mvc, zval *query TSRMLS_DC)
/** {{{ zval * yaf_route_supervar_assemble(zval *info, zval *query TSRMLS_DC)
*/
zval * yaf_route_supervar_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query TSRMLS_DC) {
zval * yaf_route_supervar_assemble(yaf_route_t *this_ptr, zval *info, zval *query TSRMLS_DC) {
smart_str tvalue = {0};
zval *pname;
zval *uri;
Expand All @@ -116,20 +116,20 @@ zval * yaf_route_supervar_assemble(yaf_route_t *this_ptr, zval *mvc, zval *query
smart_str_appendl(&tvalue, Z_STRVAL_P(pname), Z_STRLEN_P(pname));
smart_str_appendc(&tvalue, '=');

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), (void **)&tmp) == SUCCESS) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_MOUDLE_FORMAT), (void **)&tmp) == SUCCESS) {
smart_str_appendc(&tvalue, '/');
smart_str_appendl(&tvalue, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
}

if (zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp) == FAILURE) {
if (zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_CONTROLLER_FORMAT), (void **)&tmp) == FAILURE) {
yaf_trigger_error(YAF_ERR_TYPE_ERROR TSRMLS_CC, "%s", "You need to specify the controller by ':c'");
break;
}

smart_str_appendc(&tvalue, '/');
smart_str_appendl(&tvalue, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));

if(zend_hash_find(Z_ARRVAL_P(mvc), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp) == FAILURE) {
if(zend_hash_find(Z_ARRVAL_P(info), ZEND_STRS(YAF_ROUTE_ASSEMBLE_ACTION_FORMAT), (void **)&tmp) == FAILURE) {
yaf_trigger_error(YAF_ERR_TYPE_ERROR TSRMLS_CC, "%s", "You need to specify the action by ':a'");
break;
}
Expand Down Expand Up @@ -188,16 +188,16 @@ PHP_METHOD(yaf_route_supervar, __construct) {
}
/** }}} */

/** {{{ proto public Yaf_Route_Supervar::assemble(array $mvc[, array $query = NULL])
/** {{{ proto public Yaf_Route_Supervar::assemble(array $info[, array $query = NULL])
*/
PHP_METHOD(yaf_route_supervar, assemble) {
zval *mvc, *query;
zval *info, *query;
zval *return_uri;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &mvc, &query) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &info, &query) == FAILURE) {
return;
} else {
if ((return_uri = yaf_route_supervar_assemble(getThis(), mvc, query TSRMLS_CC))) {
if ((return_uri = yaf_route_supervar_assemble(getThis(), info, query TSRMLS_CC))) {
RETURN_ZVAL(return_uri, 0, 1);
}
}
Expand Down

0 comments on commit 556fc55

Please sign in to comment.