aboutsummaryrefslogtreecommitdiffstats
path: root/evaluator.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-01-30 12:53:08 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-01-30 12:53:08 +0000
commitde2e1d3b697cf0f13b06a840290b42798ed477b5 (patch)
treed3ed9a1d8913ef77a2864d079e13ff775b5fe3fe /evaluator.c
parent01263a551ad81fee5ef4a33badc2c529ac5f4060 (diff)
downloadlcd4linux-de2e1d3b697cf0f13b06a840290b42798ed477b5.tar.gz
[lcd4linux @ 2006-01-30 12:53:07 by reinelt]
replaced strncpy with strcpy where possible git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@631 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'evaluator.c')
-rw-r--r--evaluator.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/evaluator.c b/evaluator.c
index 86235a1..d22bbfa 100644
--- a/evaluator.c
+++ b/evaluator.c
@@ -1,4 +1,4 @@
-/* $Id: evaluator.c,v 1.29 2006/01/30 06:11:36 reinelt Exp $
+/* $Id: evaluator.c,v 1.30 2006/01/30 12:53:08 reinelt Exp $
*
* expression evaluation
*
@@ -23,6 +23,9 @@
*
*
* $Log: evaluator.c,v $
+ * Revision 1.30 2006/01/30 12:53:08 reinelt
+ * replaced strncpy with strcpy where possible
+ *
* Revision 1.29 2006/01/30 06:11:36 reinelt
* changed Result->length to Result->size
*
@@ -377,10 +380,10 @@ RESULT *SetResult(RESULT ** result, const int type, const void *value)
if ((*result)->string)
free((*result)->string);
/* allocate memory in multiples of CHUNK_SIZE */
- (*result)->size = CHUNK_SIZE * (len / CHUNK_SIZE + 1);
+ (*result)->size = CHUNK_SIZE * ((len+1) / CHUNK_SIZE + 1);
(*result)->string = malloc((*result)->size);
}
- strncpy((*result)->string, value, (*result)->size);
+ strcpy((*result)->string, value);
} else {
error("Evaluator: internal error: invalid result type %d", type);
return NULL;
@@ -413,7 +416,7 @@ static RESULT *CopyResult(RESULT ** result, RESULT * value)
(*result)->size = value->size;
(*result)->string = malloc((*result)->size);
}
- strncpy((*result)->string, value->string, (*result)->size);
+ strcpy((*result)->string, value->string);
}
return *result;
}
@@ -1315,7 +1318,7 @@ int Eval(void *tree, RESULT * result)
if (result->size > 0) {
result->string = malloc(result->size);
if (Tree->Result->string != NULL) {
- strncpy(result->string, Tree->Result->string, result->size);
+ strcpy(result->string, Tree->Result->string);
} else
result->string[0] = '\0';
} else {