aboutsummaryrefslogtreecommitdiffstats
path: root/indep.h
diff options
context:
space:
mode:
Diffstat (limited to 'indep.h')
-rw-r--r--indep.h23
1 files changed, 23 insertions, 0 deletions
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 */