mirror of
https://github.com/php-win-ext/pecl-expect.git
synced 2026-03-24 05:02:05 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41baa86ee3 | ||
|
|
c206870203 |
12
expect.c
12
expect.c
@@ -255,10 +255,10 @@ PHP_FUNCTION(expect_expectl)
|
||||
|
||||
key = exp_expectv (fd, ecases);
|
||||
|
||||
int exp_match_len = exp_match_end - exp_match + 1;
|
||||
int exp_match_len = exp_match_end - exp_match;
|
||||
if (z_match && exp_match && exp_match_len > 0) {
|
||||
char *tmp = (char *)emalloc (sizeof(char) * exp_match_len);
|
||||
strlcpy (tmp, exp_match, exp_match_len);
|
||||
char *tmp = (char *)emalloc (sizeof(char) * (exp_match_len + 1));
|
||||
strlcpy (tmp, exp_match, exp_match_len + 1);
|
||||
zval_dtor (z_match);
|
||||
array_init(z_match);
|
||||
add_index_string(z_match, 0, tmp, 1);
|
||||
@@ -271,9 +271,9 @@ PHP_FUNCTION(expect_expectl)
|
||||
and add matching substring to matches array */
|
||||
for (i = 1; i <= 9; i++) {
|
||||
if (matchedcase.re->startp[i] != NULL) {
|
||||
int sub_match_len = matchedcase.re->endp[i] - matchedcase.re->startp[i] + 1;
|
||||
char *sub_match = (char *)emalloc (sizeof(char) * sub_match_len);
|
||||
strlcpy (sub_match, matchedcase.re->startp[i], sub_match_len);
|
||||
int sub_match_len = matchedcase.re->endp[i] - matchedcase.re->startp[i];
|
||||
char *sub_match = (char *)emalloc (sizeof(char) * (sub_match_len + 1));
|
||||
strlcpy (sub_match, matchedcase.re->startp[i], sub_match_len + 1);
|
||||
add_next_index_string(z_match, sub_match, 1);
|
||||
efree (sub_match);
|
||||
}
|
||||
|
||||
@@ -14,11 +14,10 @@
|
||||
</maintainers>
|
||||
|
||||
<release>
|
||||
<version>0.2.1</version>
|
||||
<date>2006-07-04</date>
|
||||
<version>0.2.2</version>
|
||||
<date>2006-07-05</date>
|
||||
<state>beta</state>
|
||||
<notes>1) Support returning match substrings in array.
|
||||
2) Fix missing null-termination in returned match string.
|
||||
<notes>Fix segfault on scenario with EXP_TIMEOUT.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user