/[emacs]/emacs/src/lisp.h
ViewVC logotype

Diff of /emacs/src/lisp.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.423.2.22 by miles, Mon Oct 25 04:22:26 2004 UTC revision 1.423.2.23 by miles, Fri Oct 29 02:05:09 2004 UTC
# Line 3293  extern Lisp_Object Vdirectory_sep_char; Line 3293  extern Lisp_Object Vdirectory_sep_char;
3293  extern Lisp_Object safe_alloca_unwind (Lisp_Object);  extern Lisp_Object safe_alloca_unwind (Lisp_Object);
3294    
3295  #define USE_SAFE_ALLOCA                 \  #define USE_SAFE_ALLOCA                 \
3296    int sa_count = SPECPDL_INDEX ()    int sa_count = SPECPDL_INDEX (), sa_must_free = 0
3297    
3298  /* SAFE_ALLOCA allocates a simple buffer.  */  /* SAFE_ALLOCA allocates a simple buffer.  */
3299    
# Line 3304  extern Lisp_Object safe_alloca_unwind (L Line 3304  extern Lisp_Object safe_alloca_unwind (L
3304      else                                                  \      else                                                  \
3305        {                                                   \        {                                                   \
3306          buf = (type) xmalloc (size);                      \          buf = (type) xmalloc (size);                      \
3307            sa_must_free++;                                   \
3308          record_unwind_protect (safe_alloca_unwind,        \          record_unwind_protect (safe_alloca_unwind,        \
3309                                 make_save_value (buf, 0)); \                                 make_save_value (buf, 0)); \
3310        }                                                   \        }                                                   \
# Line 3311  extern Lisp_Object safe_alloca_unwind (L Line 3312  extern Lisp_Object safe_alloca_unwind (L
3312    
3313  /* SAFE_FREE frees xmalloced memory and enables GC as needed.  */  /* SAFE_FREE frees xmalloced memory and enables GC as needed.  */
3314    
3315  #define SAFE_FREE(size)                 \  #define SAFE_FREE()                     \
3316    do {                                  \    do {                                  \
3317      if ((size) >= MAX_ALLOCA)           \      if (sa_must_free) {                 \
3318          sa_must_free = 0;                 \
3319        unbind_to (sa_count, Qnil);       \        unbind_to (sa_count, Qnil);       \
3320        }                                   \
3321    } while (0)    } while (0)
3322    
3323    
# Line 3331  extern Lisp_Object safe_alloca_unwind (L Line 3334  extern Lisp_Object safe_alloca_unwind (L
3334          buf = (Lisp_Object *) xmalloc (size_);            \          buf = (Lisp_Object *) xmalloc (size_);            \
3335          arg_ = make_save_value (buf, nelt);               \          arg_ = make_save_value (buf, nelt);               \
3336          XSAVE_VALUE (arg_)->dogc = 1;                     \          XSAVE_VALUE (arg_)->dogc = 1;                     \
3337            sa_must_free++;                                   \
3338          record_unwind_protect (safe_alloca_unwind, arg_); \          record_unwind_protect (safe_alloca_unwind, arg_); \
3339        }                                                   \        }                                                   \
3340    } while (0)    } while (0)
3341    
 #define SAFE_FREE_LISP(nelt)                            \  
   do {                                                  \  
     if (((nelt) * sizeof (Lisp_Object)) >= MAX_ALLOCA)  \  
       unbind_to (sa_count, Qnil);                       \  
   } while (0)  
   
   
3342    
3343  #endif /* EMACS_LISP_H */  #endif /* EMACS_LISP_H */
3344    

Legend:
Removed from v.1.423.2.22  
changed lines
  Added in v.1.423.2.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26