summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPixel <>2001-04-15 16:22:38 +0000
committerPixel <>2001-04-15 16:22:38 +0000
commit0b02702da077fcf2053eab6c7a4c449933da41fe (patch)
treef853353808b2c234b66365be0a474c82f48963a1 /lib
parentefd764c90569f88d3936ad9ffe5ab5ad24fb23fa (diff)
Tables de hachages correction.
Diffstat (limited to 'lib')
-rw-r--r--lib/hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 6d890f7..2850444 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -19,7 +19,7 @@ static int FonctionHachage(char *clef)
return (i);
}
}
- return (-1);
+ return (strlen(CHAINEHACHAGE));
}
_Element CreerElement(char *Nom, _TypeVariable Var)
@@ -95,7 +95,7 @@ char SupprimerDansTab(_TableauVariable * t, char *Nom)
{
int index = FonctionHachage(Nom);
- if (0 <= index && index < strlen(CHAINEHACHAGE)) {
+ if (0 <= index && index <= strlen(CHAINEHACHAGE)) {
Supprimer(&((*t)[index]), Nom);
} else {
return (0);
@@ -107,7 +107,7 @@ char InsererVarDansTab(_TableauVariable * t, _Element e)
{
int index = FonctionHachage(e.NomVar);
- if (0 <= index && index < strlen(CHAINEHACHAGE)) {
+ if (0 <= index && index <= strlen(CHAINEHACHAGE)) {
(*t)[index] = InserTete((*t)[index], e);
} else {
return (0);
@@ -158,8 +158,8 @@ int Initialise(_TableauVariable * t)
{
unsigned int i;
- (*t) = (_TableauVariable) Emalloc(sizeof(_ListeChaine) * strlen(CHAINEHACHAGE));
- for (i = 0; i < strlen(CHAINEHACHAGE); i++) {
+ (*t) = (_TableauVariable) Emalloc(sizeof(_ListeChaine) * (strlen(CHAINEHACHAGE) + 1));
+ for (i = 0; i <= strlen(CHAINEHACHAGE); i++) {
(*t)[i] = NULL;
}
return (i);
@@ -169,7 +169,7 @@ void DetruitTab(_TableauVariable * t)
{
int i;
- for (i = 0; i < strlen(CHAINEHACHAGE); i++) {
+ for (i = 0; i <= strlen(CHAINEHACHAGE); i++) {
Detruit(&((*t)[i]));
}