Skip to content
Snippets Groups Projects
Select Git revision
1 result Searching

base64.c

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    svalue.c 17.84 KiB
    /*\
    ||| This file a part of Pike, and is copyright by Fredrik Hubinette
    ||| Pike is distributed as GPL (General Public License)
    ||| See the files COPYING and DISCLAIMER for more information.
    \*/
    #include "global.h"
    #include "main.h"
    #include "svalue.h"
    #include "stralloc.h"
    #include "array.h"
    #include "mapping.h"
    #include "multiset.h"
    #include "object.h"
    #include "program.h"
    #include "constants.h"
    #include "error.h"
    #include "dynamic_buffer.h"
    #include "interpret.h"
    
    
    struct svalue dest_ob_zero = { T_INT, 0, 0 };
    
    
    /*
     * This routine frees a short svalue given a pointer to it and
     * its type.
     */
    void free_short_svalue(union anything *s,TYPE_T type)
    {
      check_type(type);
      check_refs2(s,type);
    
      if(type <= MAX_REF_TYPE && s->refs)
      {
        if(--*(s->refs) <= 0)
        {
          union anything tmp=*s;
          s->refs=0;
          switch(type)
          {
          case T_ARRAY:
    	really_free_array(tmp.array);
    	break;
    
          case T_MAPPING:
    	really_free_mapping(tmp.mapping);
    	break;
    
          case T_MULTISET:
    	really_free_multiset(tmp.multiset);
    	break;
    
          case T_OBJECT:
    	really_free_object(tmp.object);
    	break;
    
          case T_PROGRAM:
    	really_free_program(tmp.program);
    	break;
    
          case T_STRING:
    	really_free_string(tmp.string);
    	break;
    
    #ifdef DEBUG
          default:
    	fatal("Bad type in free_short_svalue.\n");
    #endif
          }
        }