Date: 05/31/98
- Next message: rasmus: "[PHP-DEV] CVS update: php31/ext/standard"
- Previous message: rasmus: "[PHP-DEV] CVS update: php3"
- Next in thread: rasmus: "[PHP-DEV] CVS update: php3/functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sunday May 31, 1998 @ 16:59
Author: rasmus
Update of /repository/php3/functions
In directory asf:/tmp/cvs-serv29104/functions
Modified Files:
php3_string.h string.c
Log Message:
Clean up some of the string manipulation code to remove excessive use of
strlen() calls when we already know the lengths of these strings.
Index: php3/functions/php3_string.h
diff -c php3/functions/php3_string.h:1.16 php3/functions/php3_string.h:1.17
*** php3/functions/php3_string.h:1.16 Sun May 31 09:15:39 1998
--- php3/functions/php3_string.h Sun May 31 16:59:49 1998
***************
*** 29,35 ****
*/
! /* $Id: php3_string.h,v 1.16 1998/05/31 13:15:39 rasmus Exp $ */
#ifndef _PHPSTRING_H
#define _PHPSTRING_H
--- 29,35 ----
*/
! /* $Id: php3_string.h,v 1.17 1998/05/31 20:59:49 rasmus Exp $ */
#ifndef _PHPSTRING_H
#define _PHPSTRING_H
***************
*** 83,88 ****
extern char *_StrTr(char *string, char *str_from, char *str_to);
extern PHPAPI char *_php3_addslashes(char *string, int length, int *new_length, int freeit);
extern PHPAPI void _php3_stripslashes(char *string, int *len);
! extern PHPAPI void _php3_dirname(char *str);
#endif /* _PHPSTRING_H */
--- 83,88 ----
extern char *_StrTr(char *string, char *str_from, char *str_to);
extern PHPAPI char *_php3_addslashes(char *string, int length, int *new_length, int freeit);
extern PHPAPI void _php3_stripslashes(char *string, int *len);
! extern PHPAPI void _php3_dirname(char *str, int len);
#endif /* _PHPSTRING_H */
Index: php3/functions/string.c
diff -c php3/functions/string.c:1.121 php3/functions/string.c:1.122
*** php3/functions/string.c:1.121 Sun May 31 09:24:47 1998
--- php3/functions/string.c Sun May 31 16:59:50 1998
***************
*** 30,36 ****
*/
! /* $Id: string.c,v 1.121 1998/05/31 13:24:47 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 30,36 ----
*/
! /* $Id: string.c,v 1.122 1998/05/31 20:59:50 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 342,348 ****
}
convert_to_string(str);
ret = estrdup(str->value.str.val);
! c = ret + strlen(ret) -1;
while (*c == '/'
#ifdef MSVC5
|| *c == '\\'
--- 342,348 ----
}
convert_to_string(str);
ret = estrdup(str->value.str.val);
! c = ret + str->value.str.len -1;
while (*c == '/'
#ifdef MSVC5
|| *c == '\\'
***************
*** 362,371 ****
efree(ret);
}
! PHPAPI void _php3_dirname(char *str) {
register char *c;
! c = str + strlen(str) - 1;
while (*c == '/'
#ifdef MSVC5
|| *c == '\\'
--- 362,371 ----
efree(ret);
}
! PHPAPI void _php3_dirname(char *str, int len) {
register char *c;
! c = str + len - 1;
while (*c == '/'
#ifdef MSVC5
|| *c == '\\'
***************
*** 392,398 ****
}
convert_to_string(str);
ret = estrdup(str->value.str.val);
! _php3_dirname(ret);
RETVAL_STRING(ret,1);
efree(ret);
}
--- 392,398 ----
}
convert_to_string(str);
ret = estrdup(str->value.str.val);
! _php3_dirname(ret,str->value.str.len);
RETVAL_STRING(ret,1);
efree(ret);
}
***************
*** 552,558 ****
if (!*old) {
RETURN_FALSE;
}
! str = emalloc(2 * strlen(old) + 1);
for (x = 0, y = 0; old[x]; x++, y++) {
switch (old[x]) {
case '.':
--- 552,558 ----
if (!*old) {
RETURN_FALSE;
}
! str = emalloc(2 * arg->value.str.len + 1);
for (x = 0, y = 0; old[x]; x++, y++) {
switch (old[x]) {
case '.':
***************
*** 643,650 ****
str_from = (unsigned char*) from->value.str.val;
str_to = (unsigned char*) to->value.str.val;
! len1 = strlen(str_from);
! len2 = strlen(str_to);
if (len1 > len2) {
str_from[len2] = '\0';
--- 643,650 ----
str_from = (unsigned char*) from->value.str.val;
str_to = (unsigned char*) to->value.str.val;
! len1 = from->value.str.len;
! len2 = to->value.str.len;
if (len1 > len2) {
str_from[len2] = '\0';
- Next message: rasmus: "[PHP-DEV] CVS update: php31/ext/standard"
- Previous message: rasmus: "[PHP-DEV] CVS update: php3"
- Next in thread: rasmus: "[PHP-DEV] CVS update: php3/functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

