[BACK]Return to man_hash.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/Attic/man_hash.c between version 1.5 and 1.6

version 1.5, 2009/04/02 06:51:44 version 1.6, 2009/04/05 16:34:22
Line 39  man_hash_alloc(void)
Line 39  man_hash_alloc(void)
         int             *htab;          int             *htab;
         int              i, j, x;          int              i, j, x;
   
         htab = calloc(26 * 4, sizeof(int));          htab = calloc(26 * 5, sizeof(int));
         if (NULL == htab)          if (NULL == htab)
                 return(NULL);                  return(NULL);
   
Line 50  man_hash_alloc(void)
Line 50  man_hash_alloc(void)
                                 (x >= 97 && x <= 122));                                  (x >= 97 && x <= 122));
   
                 x -= (x <= 90) ? 65 : 97;                  x -= (x <= 90) ? 65 : 97;
                 x *= 4;                  x *= 5;
   
                 for (j = 0; j < 4; j++)                  for (j = 0; j < 5; j++)
                         if (0 == htab[x + j]) {                          if (0 == htab[x + j]) {
                                 htab[x + j] = i;                                  htab[x + j] = i;
                                 break;                                  break;
                         }                          }
   
                 assert(j < 4);                  assert(j < 5);
         }          }
   
         return((void *)htab);          return((void *)htab);
Line 79  man_hash_find(const void *arg, const char *tmp)
Line 79  man_hash_find(const void *arg, const char *tmp)
                 return(MAN_MAX);                  return(MAN_MAX);
   
         x -= (x <= 90) ? 65 : 97;          x -= (x <= 90) ? 65 : 97;
         x *= 4;          x *= 5;
   
         for (i = 0; i < 4; i++) {          for (i = 0; i < 5; i++) {
                 if (0 == (tok = htab[x + i]))                  if (0 == (tok = htab[x + i]))
                         return(MAN_MAX);                          return(MAN_MAX);
                 if (0 == strcmp(tmp, man_macronames[tok]))                  if (0 == strcmp(tmp, man_macronames[tok]))

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

CVSweb