[imp] No data: str_to_str patch for php3.0.6 (fwd)
| From: | php3dev | Date: | Fri, 05 Feb 1999 11:13:02 +0000 |
| Subject: | [imp] No data: str_to_str patch for php3.0.6 (fwd) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3909@lists.php.net to get a copy of this message | ||
Zeev .. this may not have gotten to php-dev
look below for ---->
o Patch applied on Dec [vmms?] reported solved *no data* problem
which has been problem at IMP last day or so
Action: Look reasonable fix?
Harv
-nnnn-
---------- Forwarded message ----------
Date: Fri, 5 Feb 1999 10:51:48 +0100
From: Mathieu Clabaut <clabault@multimania.com>
Reply-To: imp@horde.org
To: liste IMP <imp@horde.org>
Subject: [PHP-DEV] [imp] No data: str_to_str patch for php3.0.6
The following source code of the _php3_str_to_str function seems to be a
working replacement of the original one in php-3.0.6...
No more "No Data" messages since (hope it will last some times ;-))
static char *_php3_str_to_str(char *haystack, int length,
char *needle, int needle_len, char *str, int str_len, int *_new_length)
{
char *p, *q;
char *r, *s;
char *end = haystack + length;
char *new, *off;
new = malloc(length);
/* we jump through haystack searching for the needle. hurray! */
for(p = haystack, q = new;
(r = _php3_memnstr(p, needle, needle_len, end));) {
/* this ain't optimal. you could call it `efficient memory usage' */
realloc(new, (q - new) + (r - p) + (str_len) + 1);
memcpy(q, p, r - p);
q += r - p;
memcpy(q, str, str_len);
q += str_len;
p = r + needle_len;
}
/* if there is a rest, copy it */
if((end - p)>0) {
s = (q) + (end - p);
off = realloc(new, s - new + 1);
if (off != new) {
if(!off){
goto finish;
}
q += off - new;
new = off;
------> /* need to recompute s also, since q has been changed */
------> s = (q) + (end - p);
}
memcpy(q, p, end - p);
q = s;
}
finish:
*q = '\0';
if(_new_length) *_new_length = q - new;
return new;
}
______________________________________________________________________________
Mathieu CLABAUT mailto://clabault@multimania.com
DIGINEXT tel: 04 42 97 56 47
Le Tertia II, Pôle d'activite des Milles fax: 04 42 97 56 49
13851 Aix En Provence - cedex 3 e-mail: diginext@imaginet.fr
------------------------------------------------------------------------------
--
IMP mailing list: http://web.horde.org
To unsubscribe, e-mail: imp-unsubscribe@horde.org
For additional commands, e-mail: imp-help@horde.org
NNNN
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net