Enlightenment CVS committal
Author : sebastid
Project : e17
Module : libs/imlib2
Dir : e17/libs/imlib2/src/lib
Modified Files:
script.c
Log Message:
Remove excessive strlen usage.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/imlib2/src/lib/script.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- script.c 1 Nov 2004 09:45:31 -0000 1.1
+++ script.c 4 Nov 2005 08:45:38 -0000 1.2
@@ -43,10 +43,12 @@
static char *
__imlib_stripwhitespace(char *str)
{
- int i, strt = 0, in_quote = 0;
- char *tmpstr = calloc(strlen(str) + 1, sizeof(char));
+ int i, strt = 0, in_quote = 0, str_len;
+ char *tmpstr = NULL;
- for (i = 0; i < strlen(str); i++)
+ str_len = strlen(str);
+ tmpstr = calloc(str_len + 1, sizeof(char));
+ for (i = 0; i < str_len; i++)
{
if (str[i] == '\"')
in_quote = (in_quote == 0 ? 1 : 0);
@@ -124,6 +126,7 @@
__imlib_script_parse_parameters(Imlib_Image im, char *parameters)
{
int i = 0, in_quote = 0, depth = 0, start = 0, value_start =
+ int param_len;
0;
char *value = NULL;
IFunctionParam *rootptr, *ptr;
@@ -137,7 +140,8 @@
rootptr->next = NULL;
ptr = rootptr;
- for (i = 0; i <= strlen(parameters); i++)
+ param_len = strlen(parameters);
+ for (i = 0; i <= param_len; i++)
{
if (parameters[i] == '\"')
in_quote = (in_quote == 0 ? 1 : 0);
@@ -147,7 +151,7 @@
depth--;
if (!in_quote && parameters[i] == '=' && depth == 0)
value_start = i + 1;
- if (!in_quote && (parameters[i] == ',' || i == (strlen(parameters)))
+ if (!in_quote && (parameters[i] == ',' || i == param_len)
&& depth == 0)
{
ptr->next = malloc(sizeof(IFunctionParam));
@@ -240,10 +244,11 @@
__imlib_script_parse(Imlib_Image im, char *script, va_list param_list)
{
int i = 0, in_quote = 0, start = 0, depth = 0;
+ int script_len;
char *scriptbuf = NULL, *function;
D("(--) Script Parser Start.");
- if (script != NULL && strlen(script) > 0)
+ if (script != NULL && script[0] != 0)
{
vars = malloc(sizeof(IVariable));
vars->ptr = NULL;
@@ -267,7 +272,8 @@
start = 0;
i = 0;
- for (i = 0; i < strlen(scriptbuf); i++)
+ script_len = strlen(scriptbuf);
+ for (i = 0; i < script_len; i++)
{
if (script[i] == '\"')
in_quote = (in_quote == 0 ? 1 : 0);
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs