pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:4938:    break;    }       do_abort_on_signal = delay!=0.0 && args > 1    && !UNSAFE_IS_ZERO(Pike_sp + 1-args);    pop_n_elems(args);       delaysleep(delay, do_abort_on_signal, !do_abort_on_signal && delay<10);   }    - /*! @decl int gc(mapping|void quick) + /*! @decl int gc(mapping|array|void quick)    *!    *! Force garbage collection.    *!    *! @param quick    *! Perform a quick garbage collection on just this value,    *! which must have been made weak by @[set_weak_flag()].    *! All values that only have a single reference from    *! @[quick] will then be freed.    *!    *! When @[quick] hasn't been specified or is @[UNDEFINED],
pike.git/src/builtin_functions.c:4973:    *! the same as the number of freed things, but there might be some    *! difference since destroy() functions are called during freeing,    *! which can cause more things to be freed or allocated.    *!    *! @seealso    *! @[Pike.gc_parameters], @[Debug.gc_status]    */   void f_gc(INT32 args)   {    ptrdiff_t res = 0; -  if (args && (TYPEOF(Pike_sp[-args]) == PIKE_T_MAPPING)) { +  switch(args? TYPEOF(Pike_sp[-args]): PIKE_T_MIXED) { +  case PIKE_T_MAPPING:    res = do_gc_weak_mapping(Pike_sp[-args].u.mapping);    pop_n_elems(args); -  } else { +  break; +  case PIKE_T_ARRAY: +  res = do_gc_weak_array(Pike_sp[-args].u.array);    pop_n_elems(args); -  +  break; +  default: +  pop_n_elems(args);    res = do_gc(NULL, 1); -  +  break;    }    push_int(res);   }      #ifdef TYPEP   #undef TYPEP   #endif         #define TYPEP(ID,NAME,TYPE,TYPE_NAME) \