~ubuntu-branches/ubuntu/oneiric/apachetop/oneiric

« back to all changes in this revision

Viewing changes to src/map.cc

  • Committer: Bazaar Package Importer
  • Author(s): Ralf Treinen
  • Date: 2011-04-27 22:15:11 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20110427221511-e86z62ljtny5s512
Tags: 0.12.6-13
* QA upload
* Replace build-dependency on libreadline5-dev by libreadline-dev
  (closes: #553724)
* Bump version in build-dependency of debhelper (needed for overrides)
* source format 3.0 (quilt)
* patch manpage: fix missing macro invocation in manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
{
42
42
        free(tab);
43
43
 
44
 
        tab_hash->destroy();
45
44
        delete tab_hash;
46
45
 
47
46
        return 0;
99
98
                 * particular entry is incremented */
100
99
                tab[x].refcount++;
101
100
 
102
 
//              dprintf("%d Found %p %d for %s\n", time(NULL), this, x, string);
 
101
//              dprintf("%d Found %p %d %d for %s\n", time(NULL), this, x, tab[x].refcount, string);
103
102
                return x;
104
103
        }
105
104
        
188
187
 
189
188
void map::sub_ref(int pos)
190
189
{
191
 
//      dprintf("%d subref %p %d for %s\n",
192
 
//          time(NULL), this, pos, tab[pos].string);
 
190
//      dprintf("%d subref %p %d %d for %s\n",
 
191
//          time(NULL), this, pos, tab[pos].refcount, tab[pos].string);
 
192
 
 
193
        /* -1 means no/invalid position, can happen with ip map */
 
194
        if (pos < 0) return;
193
195
        
194
 
        if (tab[pos].refcount > 0)
 
196
        if (tab[pos].refcount > 0) {
195
197
                tab[pos].refcount--;
196
 
 
 
198
                if ((tab[pos].refcount == 0) && (tab[pos].string)) {
 
199
                        /* remove from hash */
 
200
                        tab_hash->remove(tab[pos].string);
 
201
                        
 
202
                        /* remove from table */
 
203
                        free(tab[pos].string);
 
204
                        tab[pos].string = NULL;
 
205
                        tab[pos].time = 0;
 
206
                }
 
207
        }
197
208
}