~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to tools/sfio/sfraise.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include        "sfhdr.h"
 
2
 
 
3
/*      Invoke event handlers for a stream
 
4
**
 
5
**      Written by Kiem-Phong Vo.
 
6
*/
 
7
#if __STD_C
 
8
int sfraise(Sfio_t* f, int type, Void_t* data)
 
9
#else
 
10
int sfraise(f, type, data)
 
11
Sfio_t* f;      /* stream               */
 
12
int     type;   /* type of event        */
 
13
Void_t* data;   /* associated data      */
 
14
#endif
 
15
{
 
16
        reg Sfdisc_t    *disc, *next, *d;
 
17
        reg int         local, rv;
 
18
 
 
19
        SFMTXSTART(f, -1);
 
20
 
 
21
        GETLOCAL(f,local);
 
22
        if(!SFKILLED(f) &&
 
23
           !(local &&
 
24
             (type == SF_NEW || type == SF_CLOSING ||
 
25
              type == SF_FINAL || type == SF_ATEXIT)) &&
 
26
           SFMODE(f,local) != (f->mode&SF_RDWR) && _sfmode(f,0,local) < 0)
 
27
                SFMTXRETURN(f, -1);
 
28
        SFLOCK(f,local);
 
29
 
 
30
        for(disc = f->disc; disc; )
 
31
        {       next = disc->disc;
 
32
 
 
33
                if(disc->exceptf)
 
34
                {       SFOPEN(f,0);
 
35
                        if((rv = (*disc->exceptf)(f,type,data,disc)) != 0 )
 
36
                                SFMTXRETURN(f, rv);
 
37
                        SFLOCK(f,0);
 
38
                }
 
39
 
 
40
                if((disc = next) )
 
41
                {       /* make sure that "next" hasn't been popped */
 
42
                        for(d = f->disc; d; d = d->disc)
 
43
                                if(d == disc)
 
44
                                        break;
 
45
                        if(!d)
 
46
                                disc = f->disc;
 
47
                }
 
48
        }
 
49
 
 
50
        SFOPEN(f,local);
 
51
        SFMTXRETURN(f, 0);
 
52
}