@@ -1344,11 +1344,6 @@ PHPAPI void _php3_char_to_str(char *str,uint len,char from,char *to,int to_len,p
1344
1344
* target = 0 ;
1345
1345
}
1346
1346
1347
- #if 0
1348
- /*
1349
- * this is a binary safe equivalent to strnstr
1350
- * note that we don't check for the end in str_to_str but here
1351
- */
1352
1347
1353
1348
static inline char *
1354
1349
_php3_memnstr (char * haystack , char * needle , int needle_len , char * end )
@@ -1414,55 +1409,6 @@ PHPAPI char *_php3_str_to_str(char *haystack, int length,
1414
1409
return new ;
1415
1410
}
1416
1411
1417
- #else
1418
-
1419
- static char * _php3_memstr (char * s , char * c , size_t n , size_t m )
1420
- {
1421
- char * p ;
1422
-
1423
- for (p = s ; (p - s ) < n ; p ++ )
1424
- if (memcmp (p , c , m ) == 0 )
1425
- return p ;
1426
- return NULL ;
1427
- }
1428
-
1429
- #define ATTCHSTR (st , sz ) \
1430
- nl += sz; \
1431
- n = erealloc(n, nl + 1); \
1432
- memcpy(n + no, st, sz); \
1433
- no += sz
1434
-
1435
-
1436
- PHPAPI char * _php3_str_to_str (char * a , int al , char * b , int bl , char * c , int cl ,
1437
- int * newlen )
1438
- {
1439
- char * n = NULL , * p , * q ;
1440
- int nl = 0 ;
1441
- int no = 0 ;
1442
-
1443
- /* run through all occurences of b in a */
1444
- for (p = q = a ; (p = _php3_memstr (p , b , al - (p - a ), bl )); q = p ) {
1445
- /* attach everything between the previous occ. and this one */
1446
- ATTCHSTR (q , p - q );
1447
- /* attach the replacement string c */
1448
- ATTCHSTR (c , cl );
1449
- /* jump over string b in a */
1450
- p += bl ;
1451
- }
1452
-
1453
- /* anything left over ? */
1454
- if ((al - (q - a )) > 0 ) {
1455
- ATTCHSTR (q , al - (q - a ));
1456
- }
1457
-
1458
- if (newlen ) * newlen = nl ;
1459
- n [nl ] = '\0' ;
1460
-
1461
- return n ;
1462
- }
1463
-
1464
- #undef ATTCHSTR
1465
- #endif
1466
1412
1467
1413
/* {{{ proto string str_replace(string needle, string str, string haystack)
1468
1414
Replace all occurrences of needle in haystack with str */
0 commit comments