/[LeafOK_CVS]/pvpgn-1.7.4/src/common/rcm.c
ViewVC logotype

Annotation of /pvpgn-1.7.4/src/common/rcm.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-csrc
no message

1 sysadm 1.1 /*
2     * Copyright (C) 2004 Dizzy (dizzy@roedu.net)
3     *
4     * This program is free software; you can redistribute it and/or
5     * modify it under the terms of the GNU General Public License
6     * as published by the Free Software Foundation; either version 2
7     * of the License, or (at your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful,
10     * but WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     * GNU General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with this program; if not, write to the Free Software
16     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17     */
18    
19     #include "common/setup_before.h"
20     #ifdef HAVE_ASSERT_H
21     # include <assert.h>
22     #endif
23     #include "common/xalloc.h"
24     #include "common/elist.h"
25     #include "common/rcm.h"
26     #include "common/setup_after.h"
27    
28     extern void rcm_init(t_rcm *rcm)
29     {
30     assert(rcm);
31    
32     elist_init(&rcm->refs);
33     rcm->count = 0;
34     }
35    
36     extern void rcm_regref_init(t_rcm_regref *regref, t_chref_cb cb, void *data)
37     {
38     assert(regref);
39    
40     elist_init(&regref->refs_link);
41     regref->chref = cb;
42     regref->data = data;
43     }
44    
45     extern void rcm_get(t_rcm *rcm, t_rcm_regref *regref)
46     {
47     assert(rcm);
48     assert(regref);
49    
50     rcm->count++;
51     elist_add_tail(&rcm->refs,&regref->refs_link);
52     }
53    
54     extern void rcm_put(t_rcm *rcm, t_rcm_regref *regref)
55     {
56     assert(rcm);
57     assert(regref);
58     assert(rcm->count); /* might use eventlog but I want this stopped fast */
59    
60     rcm->count--;
61     elist_del(&regref->refs_link);
62     }
63    
64     extern void rcm_chref(t_rcm *rcm, void *newref)
65     {
66     t_elist *curr, *save;
67     t_rcm_regref *regref;
68    
69     assert(rcm);
70    
71     elist_for_each_safe(curr,&rcm->refs,save) {
72     regref = elist_entry(curr,t_rcm_regref,refs_link);
73     if (regref->chref) regref->chref(regref->data,newref);
74     }
75     }

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1