home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / desklib / Libraries / Icon / c / DisposeInd < prev    next >
Encoding:
Text File  |  1993-04-30  |  1.6 KB  |  46 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Icons.DisposeInd.c
  12.     Author:  Copyright © 1993 (Tim Browse?)
  13.     Version: 1.00 (27 Mar 1993)
  14.     Purpose: Dispose indirected data space used by an icon. Note that this
  15.              data must have been allocated with malloc() originally.
  16. */
  17.  
  18. #include <stdlib.h>
  19. #include "Wimp.h"
  20. #include "Icon.h"
  21.  
  22.  
  23. extern void Icon_DisposeIndData(icon_data *data, icon_flags flags)
  24. {
  25.   /* make sure this icon is indirected - exit quietly if not */
  26.   if ((data == NULL) || (!flags.data.indirected))
  27.     return;
  28.  
  29.   if (!flags.data.text && flags.data.sprite)             /* Sprite only icon */
  30.   {
  31.     if (data->indirectsprite.nameisname)
  32.       free((void *) data->indirectsprite.name);
  33.     return;
  34.   }
  35.  
  36.   if (flags.data.text || flags.data.sprite)        /* Text/Text&Sprite icon */
  37.   {
  38.     free(data->indirecttext.buffer);
  39.  
  40.     /* Free validation string, if there is one */
  41.     if ((data->indirecttext.validstring != NULL) &&
  42.         (data->indirecttext.validstring != (char *) 0xffffffff))
  43.       free(data->indirecttext.validstring);
  44.   }       
  45. }
  46.