home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lzop-1.00.tar.gz / lzop-1.00.tar / lzop-1.00 / src / s_object.c < prev    next >
C/C++ Source or Header  |  1998-04-15  |  2KB  |  86 lines

  1. /* s_object.c --
  2.  
  3.    This file is part of the lzop file compressor.
  4.  
  5.    Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
  6.    Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
  7.    Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
  8.  
  9.    lzop and the LZO library are free software; you can redistribute them
  10.    and/or modify them under the terms of the GNU General Public License as
  11.    published by the Free Software Foundation; either version 2 of
  12.    the License, or (at your option) any later version.
  13.  
  14.    This program is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.    GNU General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU General Public License
  20.    along with this program; see the file COPYING.
  21.    If not, write to the Free Software Foundation, Inc.,
  22.    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23.  
  24.    Markus F.X.J. Oberhumer
  25.    markus.oberhumer@jk.uni-linz.ac.at
  26.  */
  27.  
  28.  
  29. #include "lzop.h"
  30.  
  31. #if defined(USE_SCREEN)
  32.  
  33. #include "screen.h"
  34.  
  35.  
  36. /*************************************************************************
  37. //
  38. **************************************************************************/
  39.  
  40. void sobject_destroy(screen_t *this)
  41. {
  42.     if (!this)
  43.         return;
  44.     if (this->data)
  45.     {
  46.         if (this->finalize)
  47.             this->finalize(this);
  48.         free(this->data);
  49.         this->data = NULL;
  50.     }
  51.     free(this);
  52. }
  53.  
  54.  
  55. screen_t *sobject_construct(const screen_t *c, size_t data_size)
  56. {
  57.     screen_t *this;
  58.  
  59.     /* allocate object */
  60.     this = (screen_t *) malloc(sizeof(*this));
  61.     if (!this)
  62.         return NULL;
  63.  
  64.     /* copy function table */
  65.     *this = *c;
  66.  
  67.     /* initialize instance variables */
  68.     this->data = (struct screen_data_t *) malloc(data_size);
  69.     if (!this->data)
  70.     {
  71.         free(this);
  72.         return NULL;
  73.     }
  74.     memset(this->data,0,data_size);
  75.  
  76.     return this;
  77. }
  78.  
  79. #endif /* defined(USE_SCREEN) */
  80.  
  81.  
  82. /*
  83. vi:ts=4
  84. */
  85.  
  86.