[go: nahoru, domu]

Skip to content

Commit

Permalink
Fix -Wunused-but-set-variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsky committed Dec 8, 2012
1 parent f0dd42a commit 9ff4497
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
12 changes: 4 additions & 8 deletions mecab/mecab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,10 +1443,9 @@ php_mecab_node_get_sibling_wrapper(INTERNAL_FUNCTION_PARAMETERS, php_mecab_node_
zval *object = getThis();
zval *znode = NULL;
php_mecab_node *xnode = NULL;
const mecab_node_t *node = NULL;

/* parse the arguments */
PHP_MECAB_NODE_FROM_PARAMETER();
PHP_MECAB_NODE_INTERNAL_FROM_PARAMETER();

php_mecab_node_get_sibling(return_value, object, xnode, rel TSRMLS_CC);
}
Expand All @@ -1462,10 +1461,9 @@ php_mecab_node_get_path_wrapper(INTERNAL_FUNCTION_PARAMETERS, php_mecab_node_rel
zval *object = getThis();
zval *znode = NULL;
php_mecab_node *xnode = NULL;
const mecab_node_t *node = NULL;

/* parse the arguments */
PHP_MECAB_NODE_FROM_PARAMETER();
PHP_MECAB_NODE_INTERNAL_FROM_PARAMETER();

php_mecab_node_get_path(return_value, object, xnode, rel TSRMLS_CC);
}
Expand All @@ -1481,10 +1479,9 @@ php_mecab_path_get_sibling_wrapper(INTERNAL_FUNCTION_PARAMETERS, php_mecab_path_
zval *object = getThis();
zval *zpath = NULL;
php_mecab_path *xpath = NULL;
const mecab_path_t *path = NULL;

/* parse the arguments */
PHP_MECAB_PATH_FROM_PARAMETER();
PHP_MECAB_PATH_INTERNAL_FROM_PARAMETER();

php_mecab_path_get_sibling(return_value, object, xpath, rel TSRMLS_CC);
}
Expand All @@ -1500,10 +1497,9 @@ php_mecab_path_get_node_wrapper(INTERNAL_FUNCTION_PARAMETERS, php_mecab_path_rel
zval *object = getThis();
zval *zpath = NULL;
php_mecab_path *xpath = NULL;
const mecab_path_t *path = NULL;

/* parse the arguments */
PHP_MECAB_PATH_FROM_PARAMETER();
PHP_MECAB_PATH_INTERNAL_FROM_PARAMETER();

php_mecab_path_get_node(return_value, object, xpath, rel TSRMLS_CC);
}
Expand Down
18 changes: 14 additions & 4 deletions mecab/php_mecab_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define PHP_MECAB_FETCH_OBJECT(ptr, type, zv) ptr = (type)zend_object_store_get_object((zv) TSRMLS_CC)

#define PHP_MECAB_RSRC_FROM_PARAMETER() { \
#define PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER() { \
if (object) { \
zmecab = object; \
if (ZEND_NUM_ARGS() != 0) { \
Expand All @@ -22,10 +22,13 @@
} \
ZEND_FETCH_RESOURCE(xmecab, php_mecab *, &zmecab, -1, "mecab", le_mecab); \
} \
mecab = xmecab->ptr; \
}

#define PHP_MECAB_RSRC_FROM_PARAMETER2(name) { \
#define PHP_MECAB_RSRC_FROM_PARAMETER() \
PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER() \
mecab = xmecab->ptr; \

#define PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(name) { \
if (object) { \
z##name = object; \
if (ZEND_NUM_ARGS() != 0) { \
Expand All @@ -41,9 +44,12 @@
} \
ZEND_FETCH_RESOURCE(x##name, php_mecab_##name *, &z##name, -1, "mecab_" #name, le_mecab_##name); \
} \
name = x##name->ptr; \
}

#define PHP_MECAB_RSRC_FROM_PARAMETER2(name) \
PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(name) \
name = x##name->ptr;

#define PHP_MECAB_PARSE_PARAMETERS(fmt, ...) { \
if (object) { \
zmecab = object; \
Expand Down Expand Up @@ -109,6 +115,10 @@
#define PHP_MECAB_NODE_FROM_PARAMETER() PHP_MECAB_RSRC_FROM_PARAMETER2(node)
#define PHP_MECAB_PATH_FROM_PARAMETER() PHP_MECAB_RSRC_FROM_PARAMETER2(path)

#define PHP_MECAB_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER()
#define PHP_MECAB_NODE_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(node)
#define PHP_MECAB_PATH_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(path)

#define PHP_MECAB_NODE_PARSE_PARAMETERS(fmt, ...) PHP_MECAB_PARSE_PARAMETERS2(node, fmt, __VA_ARGS__)
#define PHP_MECAB_PATH_PARSE_PARAMETERS(fmt, ...) PHP_MECAB_PARSE_PARAMETERS2(path, fmt, __VA_ARGS__)

Expand Down

0 comments on commit 9ff4497

Please sign in to comment.