diff options
author | AIDA Shinra <shinra@j10n.org> | 2013-10-14 13:31:01 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@debian.org> | 2013-10-14 13:31:01 +0000 |
commit | ec81194f386f35b0d914e0fc5c727cd217c62c91 (patch) | |
tree | 1a64910741c607abe7d19b92bdfa34f3506507ae /indep.h | |
parent | Merge from upstream on 2012-05-22 (diff) | |
download | w3m-ec81194f386f35b0d914e0fc5c727cd217c62c91.tar.gz w3m-ec81194f386f35b0d914e0fc5c727cd217c62c91.zip |
Workaround of GC crash on Cygwin64
Patch from <http://www.j10n.org/files/w3m-cvs-1.1055-win64gc.patch>,
[w3m-dev:04469] on 2013-10-14.
Diffstat (limited to '')
-rw-r--r-- | indep.h | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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 */ |