Пример #1
0
void unUseStr(const char *s)
{
    StrItem *cur, *prev;

    unsigned int h = hashStr(s);
    cur = strTbl[h];
    prev = cur;
    while (cur != 0) {
      if (strcasecmp(cur->s,s) == 0) {
	cur->refCnt--;
	/* if that was the last reference to this string, kill it. */
	if (cur->refCnt == 0) {
	  if (cur == strTbl[h]) {
	    strTbl[h] = cur->next;
	    deleteStr(prev->s);
	    deleteStrItem(prev);
	  } else {
	    prev->next = cur->next;
	    deleteStr(cur->s);
	    deleteStrItem(cur);
	  }
	  return;
	}
      }
      prev = cur;
      cur = cur->next;
    }
}
Пример #2
0
DLLEXPORT(void) unUseStr(const char *s)
{
    StrItem *t, *p;
    unsigned int h = hashStr(s);
    if ((t = strTbl[h]) != 0) {
	p = t;
	do {
	    if (qstricmp(t->s,s) == 0) {
		t->refCnt--;
		if (t->refCnt == 0) {
		    if (p == strTbl[h]) {
			strTbl[h] = t->next;
			}
		    else {
			p->next = t->next;
			}
		    deleteStr(t->s);
		    deleteStrItem(t);
		    return;
		    }
		}
	    p = t;
	    t = t->next;
	    } while (t);
	}
}
Пример #3
0
void unUseStr(const char *s)
{
  StrItem *t, *p;
  unsigned int h = hashStr(s);
  if ((t = strTbl[h]) != 0) {
    p = t;
    do {
      if (PL_strcasecmp(t->s,s) == 0) {
        t->refCnt--;
        if (t->refCnt == 0) {
          if (t == strTbl[h]) {
            strTbl[h] = t->next;
          }
          else {
            p->next = t->next;
          }
          deleteString((char *)t->s);
          deleteStrItem(t);
          return;
        }
      }
      p = t;
      t = t->next;
     } while (t);
  }
}
Пример #4
0
DLLEXPORT(void) cleanStrTbl()
{
    int i;
    for (i=0; i<STRTBLSIZE;i++) {
	StrItem *t = strTbl[i];
	while (t) {
	    StrItem *p;
	    deleteStr(t->s);
	    p = t;
	    t = t->next;
	    deleteStrItem(p);
	    } while (t);
	strTbl[i] = 0;
	}
}