summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPixel <>2001-04-16 00:41:33 +0000
committerPixel <>2001-04-16 00:41:33 +0000
commit3704103d814f827a3a7a2f9a9152f2e8e88bb88b (patch)
tree0fa4ff7e808153feb57ed038cd82ca28b89a943f /lib
parentcdd4766d59b8908b1e70e8f1117ea3dadd7e6adf (diff)
Tables de hachages
Diffstat (limited to 'lib')
-rw-r--r--lib/hash.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 80e44af..207439d 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);
@@ -159,7 +159,7 @@ int Initialise(_TableauVariable * t)
unsigned int i;
(*t) = (_TableauVariable) Emalloc(sizeof(_ListeChaine) * (strlen(CHAINEHACHAGE) + 1));
- for (i = 0; i < strlen(CHAINEHACHAGE); i++) {
+ 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]));
}