Skip to content
Snippets Groups Projects
Select Git revision
  • 611b06ecba259630208c8d18bea4ebdbd451bfd7
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

array.c

Blame
  • array.c 51.76 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 "svalue.h"
    #include "array.h"
    #include "object.h"
    #include "las.h"
    #include "stralloc.h"
    #include "interpret.h"
    #include "opcodes.h"
    #include "pike_error.h"
    #include "pike_types.h"
    #include "fsort.h"
    #include "builtin_functions.h"
    #include "pike_memory.h"
    #include "gc.h"
    #include "main.h"
    #include "security.h"
    #include "stuff.h"
    #include "bignum.h"
    
    RCSID("$Id: array.c,v 1.112 2001/06/11 18:03:23 mast Exp $");
    
    PMOD_EXPORT struct array empty_array=
    {
      PIKE_CONSTANT_MEMOBJ_INIT(1), /* Never free */
      &weak_empty_array,     /* Next */
      &weak_shrink_empty_array, /* previous (circular) */
      0,                     /* Size = 0 */
      0,                     /* malloced Size = 0 */
      0,                     /* no types */
      0,			 /* no flags */
      empty_array.real_item, /* Initialize the item pointer. */
    };
    PMOD_EXPORT struct array weak_empty_array=
    {
      PIKE_CONSTANT_MEMOBJ_INIT(1),
      &weak_shrink_empty_array, &empty_array, 0, 0, 0, ARRAY_WEAK_FLAG,
      weak_empty_array.real_item,
    };
    PMOD_EXPORT struct array weak_shrink_empty_array=
    {
      PIKE_CONSTANT_MEMOBJ_INIT(1),
      &empty_array, &weak_empty_array, 0, 0, 0, ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK,
      weak_shrink_empty_array.real_item,
    };
    
    struct array *gc_internal_array = &empty_array;
    static struct array *gc_mark_array_pos = 0;
    
    
    /* Allocate an array, this might be changed in the future to
     * allocate linked lists or something
     * NOTE: the new array have zero references
     */
    
    PMOD_EXPORT struct array *low_allocate_array(ptrdiff_t size, ptrdiff_t extra_space)
    {
      struct array *v;
      ptrdiff_t e;
    
      if(size == 0)
      {
        add_ref(&empty_array);
        return &empty_array;
      }