/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2003-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Phong Vo <[email protected]> *17* *18***********************************************************************/19#include "vchdr.h"2021/* Close a Vcodex_t handle22**23** Written by Kiem-Phong Vo ([email protected])24*/2526#if __STD_C27int vcclose(Vcodex_t* vc)28#else29int vcclose(vc)30Vcodex_t* vc;31#endif32{33if(!vc)34return -1;3536if(vc->disc && vc->disc->eventf &&37(*vc->disc->eventf)(vc, VC_CLOSING, NIL(Void_t*), vc->disc) < 0 )38return -1;3940vcbuffer(vc, NIL(Vcchar_t*), -1, -1); /* free all cached buffers */4142if(vc->coder && (vc->flags&VC_CLOSECODER) && vcclose(vc->coder) < 0 )43return -1;4445if(vcfreecontext(vc, NIL(Vccontext_t*)) < 0 )46return -1;4748if(vc->meth && vc->meth->eventf &&49(*vc->meth->eventf)(vc, VC_CLOSING, NIL(Void_t*)) < 0 )50return -1;5152free(vc);5354return 0;55}565758