repeated.c
changeset 6 bc41369f4587
parent 5 c87681fff7d3
equal deleted inserted replaced
5:c87681fff7d3 6:bc41369f4587
    69 
    69 
    70     el = (struct HashElement *) fastmalloc(sizeof(*el));
    70     el = (struct HashElement *) fastmalloc(sizeof(*el));
    71     el->def = ptr;
    71     el->def = ptr;
    72     el->next = 0;
    72     el->next = 0;
    73     el->index = index;
    73     el->index = index;
       
    74     /*
       
    75     printf("New index: %i\n", index);
       
    76     */
    74 
    77 
    75     /* Let the last point to the new element */
    78     /* Let the last point to the new element */
    76     if (ndhash[hash] != 0)
    79     if (ndhash[hash] != 0)
    77     {
    80     {
    78         dhash_last[hash]->next = el;
    81         dhash_last[hash]->next = el;
    97     {
   100     {
    98         struct Def *hdef = h->def;
   101         struct Def *hdef = h->def;
    99         if (hdef->length == ptr->length
   102         if (hdef->length == ptr->length
   100                 && (strncmp(hdef->d, ptr->d, ptr->length) == 0))
   103                 && (strncmp(hdef->d, ptr->d, ptr->length) == 0))
   101             /* Repeated found !*/
   104             /* Repeated found !*/
       
   105         {
       
   106             /*
       
   107             printf("Found: l1: %i l2: %i => %i\n", ptr->length, hdef->length,
       
   108                     h->index);
       
   109                     */
   102             return h->index;
   110             return h->index;
       
   111         }
       
   112         h = h->next;
   103     }
   113     }
   104 
   114 
   105     /* Not found */
   115     /* Not found */
   106     return -1;
   116     return -1;
   107 }
   117 }