From ec81194f386f35b0d914e0fc5c727cd217c62c91 Mon Sep 17 00:00:00 2001 From: AIDA Shinra Date: Mon, 14 Oct 2013 22:31:01 +0900 Subject: Workaround of GC crash on Cygwin64 Patch from , [w3m-dev:04469] on 2013-10-14. --- indep.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'indep.h') diff --git a/indep.h b/indep.h index b3819a3..f698f98 100644 --- a/indep.h +++ b/indep.h @@ -12,6 +12,14 @@ #define FALSE 0 #endif /* FALSE */ +struct growbuf { + char *ptr; + int length; + int area_size; + void *(*realloc_proc) (void *, size_t); + void (*free_proc) (void *); +}; + #define RAW_MODE 0 #define PAGER_MODE 1 #define HTML_MODE 2 @@ -64,6 +72,18 @@ extern Str Str_url_unquote(Str x, int is_form, int safe); extern Str Str_form_quote(Str x); #define Str_form_unquote(x) Str_url_unquote((x), TRUE, FALSE) extern char *shell_quote(char *str); +#define xmalloc(s) xrealloc(NULL, s) +extern void *xrealloc(void *ptr, size_t size); +extern void xfree(void *ptr); +extern void *w3m_GC_realloc_atomic(void *ptr, size_t size); +extern void w3m_GC_free(void *ptr); +extern void growbuf_init(struct growbuf *gb); +extern void growbuf_init_without_GC(struct growbuf *gb); +extern void growbuf_clear(struct growbuf *gb); +extern Str growbuf_to_Str(struct growbuf *gb); +extern void growbuf_reserve(struct growbuf *gb, int leastarea); +extern void growbuf_append(struct growbuf *gb, const char *src, int len); +#define GROWBUF_ADD_CHAR(gb,ch) ((((gb)->length>=(gb)->area_size)?growbuf_reserve(gb,(gb)->length+1):(void)0),(void)((gb)->ptr[(gb)->length++] = (ch))) extern char *w3m_auxbin_dir(); extern char *w3m_lib_dir(); @@ -76,5 +96,8 @@ extern char *w3m_help_dir(); #define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) #define NewAtom_N(type,n) ((type*)GC_MALLOC_ATOMIC((n)*sizeof(type))) #define New_Reuse(type,ptr,n) ((type*)GC_REALLOC((ptr),(n)*sizeof(type))) +#define NewWithoutGC(type) ((type*)xmalloc(sizeof(type))) +#define NewWithoutGC_N(type,n) ((type*)xmalloc((n)*sizeof(type))) +#define NewWithoutGC_Reuse(type,ptr,n) ((type*)xrealloc(ptr,(n)*sizeof(type))) #endif /* INDEP_H */ -- cgit v1.2.3