/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: s_free.c,v 1.2 1997/09/25 17:59:32 ae59 Exp $ */
/*
$Log: s_free.c,v $
 * Revision 1.2  1997/09/25  17:59:32  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:24:39  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : s_free.c                              */
/*                                                              */
/*      Entry           : void s_free(d)                        */
/*                        s_trng *d;                            */
/*                                                              */
/*      Arguments       : d - descriptor of string              */
/*                                                              */
/*      Description     : free string                           */
/*                                                              */
/*      Date            : 1990-11-12                            */
/*      1990-11-12 : test alen>0 before freeing array           */
/*      1990-10-17 : new flag suba in s_trng                    */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local void s_free(s_trng *d)
#else
local void s_free(d)

s_trng *d;
#endif
        {
        if (d->suba) return;

        if (d->alen>0 && (char *)d->ptr!=NULL)
           {
#ifdef HEAP_CHECK
b_freh((a_char *)&d->ptr,(a_char *)d->ptr,(a_char *)"s_free");
#endif
           free((char *)d->ptr);
           d->ptr = NULL;
           }

        d->clen = d->alen = d->tmp = 0;

        return;
        }
