EndTest is still failing, but the void*[] typemap isn't segfaulting anymore
This commit is contained in:
parent
d544c2f4bb
commit
9f55409246
2 changed files with 17 additions and 11 deletions
|
|
@ -12,12 +12,14 @@ class EndPTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testSuccess()
|
public function testSuccess()
|
||||||
{
|
{
|
||||||
$result = h_parse($this->parser, "a");
|
$result = h_parse($this->parser, ["a"]);
|
||||||
|
var_dump($result);
|
||||||
$this->assertEquals("a", $result);
|
$this->assertEquals("a", $result);
|
||||||
}
|
}
|
||||||
public function testFailure()
|
public function testFailure()
|
||||||
{
|
{
|
||||||
$result = h_parse($this->parser, "aa");
|
$result = h_parse($this->parser, "aa");
|
||||||
|
var_dump($result);
|
||||||
$this->assertEquals(NULL, $result);
|
$this->assertEquals(NULL, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,18 +171,22 @@
|
||||||
int size = zend_hash_num_elements(arr);
|
int size = zend_hash_num_elements(arr);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
$1 = (void**)malloc((size+1)*sizeof(HParser*));
|
$1 = (void**)malloc((size)*sizeof(HParser*));
|
||||||
for (zend_hash_internal_pointer_reset_ex(arr, &pointer);
|
for (i=0; i<size; i++) {
|
||||||
zend_hash_get_current_data_ex(arr, (void**)&data, &pointer);
|
HParser *p;
|
||||||
zend_hash_move_forward_ex(arr, &pointer), i++) {
|
if (zend_hash_index_find(arr, i, (void**)&p) == FAILURE) {
|
||||||
res = SWIG_ConvertPtr(*data, &($1[i]), SWIGTYPE_p_HParser_, 0 | 0);
|
// FIXME raise some error
|
||||||
if (!SWIG_IsOk(res)) {
|
$1 = NULL;
|
||||||
// TODO do we not *have* SWIG_TypeError?
|
} else {
|
||||||
SWIG_exception_fail(res, "that wasn't an HParser");
|
res = SWIG_ConvertPtr(*data, &($1[i]), SWIGTYPE_p_HParser_, 0 | 0);
|
||||||
|
if (!SWIG_IsOK(res)) {
|
||||||
|
// TODO do we not *have* SWIG_TypeError?
|
||||||
|
SWIG_exception_fail(res, "that wasn't an HParser");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// FIXME raise some error
|
// FIXME some error
|
||||||
$1 = NULL;
|
$1 = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue