home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / FREEFP.C < prev    next >
Text File  |  1995-11-02  |  3KB  |  49 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   freefp.c                                                                */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*   Free an AFILE block.                                                    */
  7. /*   The specified AFILE block is dequeued and freed.                        */
  8. /*   The associated source buffer and offset table (if any)                  */
  9. /*   are also freed.                                                         */
  10. /*                                                                           */
  11. /* History:                                                                  */
  12. /*                                                                           */
  13. /*   02/08/91 Creation of 32-bit SD86, from 16-bit version.                  */
  14. /*                                                                           */
  15. /*...16->32 port.                                                            */
  16. /*...                                                                        */
  17. /*... 02/08/91  106   Srinivas  port to 32 bit.                              */
  18. /*... 02/08/91  112   Joe       port to 32 bit.                              */
  19. /*...                                                                        */
  20. /*...Release 1.00 (Pre-release 108 12/05/91)                                 */
  21. /*...                                                                        */
  22. /*... 02/21/92  521   Srinivas  Port to C-Set/2.                             */
  23. /*****************************************************************************/
  24.  
  25. #define INCL_16                         /* 16-bit API                     106*/
  26. #include "all.h"                        /* SD86 include files                */
  27.  
  28. extern uint        MaxActMods;
  29. extern AFILE*      allfps;
  30.  
  31.  void
  32. freefp(AFILE *fp)
  33. {
  34.     AFILE *p;                           /* was register.                  112*/
  35.  
  36.     /* Note: "next" must be 1st field in the AFILE block for this code */
  37.     for( p = (AFILE *) &allfps; p; p = p->next ){
  38.         if( fp == p->next ){
  39.             p->next = fp->next;
  40.             if( fp->source )
  41.                DosFreeSeg(Flat2Sel(fp->source));                        /*106*/
  42.             if( fp->offtab )
  43.                Tfree((void *)(fp->offtab));                              /*521*/
  44.             Tfree( ( void * )fp);                                        /*521*/
  45.             return;
  46.     }   }
  47.     panic(OOfreefp);
  48. }
  49.