[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.9 and 1.10

version 1.9, 2009/06/16 19:55:28 version 1.10, 2009/06/18 10:32:00
Line 37  man_hash_alloc(void)
Line 37  man_hash_alloc(void)
         int             *htab;          int             *htab;
         int              i, j, x;          int              i, j, x;
   
         htab = calloc(26 * 5, sizeof(int));          /* Initialised to -1. */
   
           htab = malloc(26 * 5 * sizeof(int));
         if (NULL == htab)          if (NULL == htab)
                 return(NULL);                  return(NULL);
           for (i = 0; i < 26 * 5; i++)
                   htab[i] = -1;
   
         for (i = 0; i < MAN_MAX; i++) {          for (i = 0; i < MAN_MAX; i++) {
                 x = man_macronames[i][0];                  x = man_macronames[i][0];
Line 51  man_hash_alloc(void)
Line 55  man_hash_alloc(void)
                 x *= 5;                  x *= 5;
   
                 for (j = 0; j < 5; j++)                  for (j = 0; j < 5; j++)
                         if (0 == htab[x + j]) {                          if (-1 == htab[x + j]) {
                                 htab[x + j] = i;                                  htab[x + j] = i;
                                 break;                                  break;
                         }                          }
Line 80  man_hash_find(const void *arg, const char *tmp)
Line 84  man_hash_find(const void *arg, const char *tmp)
         x *= 5;          x *= 5;
   
         for (i = 0; i < 5; i++) {          for (i = 0; i < 5; i++) {
                 if (0 == (tok = htab[x + i]))                  if (-1 == (tok = htab[x + i]))
                         return(MAN_MAX);                          return(MAN_MAX);
                 if (0 == strcmp(tmp, man_macronames[tok]))                  if (0 == strcmp(tmp, man_macronames[tok]))
                         return(tok);                          return(tok);

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

CVSweb