Lines Matching refs:f2
33 Sfio_t* sfswap(reg Sfio_t* f1, reg Sfio_t* f2)
35 Sfio_t* sfswap(f1,f2)
37 reg Sfio_t* f2;
45 if(f2 && SFFROZEN(f2) && (f2->mode&SF_PUSH) )
47 if(f1 == f2)
48 return f2;
54 if(f2)
55 { f2mode = f2->mode;
56 SFLOCK(f2,0);
57 f2->mode |= SF_PUSH; /* make sure there is no recursion on f2 */
60 { f2 = f1->file == 0 ? sfstdin :
63 if((!f2 || !(f2->mode&SF_AVAIL)) )
64 { if(!(f2 = (Sfio_t*)malloc(sizeof(Sfio_t))) )
70 SFCLEAR(f2,NIL(Vtmutex_t*));
72 f2->mode = SF_AVAIL|SF_LOCK;
81 if(!f2->pool)
83 else for(f2pool = f2->pool->n_sf-1; f2pool >= 0; --f2pool)
84 if(f2->pool->sf[f2pool] == f2)
88 f2flags = f2->flags;
92 memcpy((Void_t*)f1,(Void_t*)f2,sizeof(Sfio_t));
93 memcpy((Void_t*)f2,(Void_t*)(&tmp),sizeof(Sfio_t));
97 f2->pool->sf[f1pool] = f2;
100 f2->flags |= SF_STATIC;
101 else f2->flags &= ~SF_STATIC;
116 f2->mode = f1mode;
117 SFOPEN(f2,0);
118 return f2;