aboutsummaryrefslogtreecommitdiffstats
path: root/indep.h
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2021-01-02 00:20:37 +0000
committerTatsuya Kinoshita <tats@debian.org>2021-01-02 00:20:37 +0000
commit1d0ba25a660483da1272a31dd077ed94441e3d9f (patch)
tree1d8dee52cd1e3d340fe178a8193dc96c4496db84 /indep.h
parentMerge branch 'cvstrunk' into upstream (diff)
downloadw3m-1d0ba25a660483da1272a31dd077ed94441e3d9f.tar.gz
w3m-1d0ba25a660483da1272a31dd077ed94441e3d9f.zip
New upstream version 0.5.3+git20210102upstream/0.5.3+git20210102upstream
Diffstat (limited to '')
-rw-r--r--indep.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/indep.h b/indep.h
index b3819a3..5c6b1da 100644
--- a/indep.h
+++ b/indep.h
@@ -1,7 +1,7 @@
/* $Id: indep.h,v 1.16 2003/09/22 21:02:19 ukai Exp $ */
#ifndef INDEP_H
#define INDEP_H
-#include <gc.h>
+#include "alloc.h"
#include "Str.h"
#include "config.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
@@ -19,7 +27,7 @@
extern unsigned char QUOTE_MAP[];
extern char *HTML_QUOTE_MAP[];
-#define HTML_QUOTE_MASK 0x07 /* &, <, >, " */
+#define HTML_QUOTE_MASK 0x07 /* &, <, >, ", ' */
#define SHELL_UNSAFE_MASK 0x08 /* [^A-Za-z0-9_./:\200-\377] */
#define URL_QUOTE_MASK 0x10 /* [\0- \177-\377] */
#define FILE_QUOTE_MASK 0x30 /* [\0- #%&+:?\177-\377] */
@@ -52,6 +60,7 @@ extern int strncasecmp(const char *s1, const char *s2, size_t n);
extern char *strcasestr(const char *s1, const char *s2);
#endif
extern int strcasemstr(char *str, char *srch[], char **ret_ptr);
+int strmatchlen(const char *s1, const char *s2, int maxlen);
extern char *remove_space(char *str);
extern int non_null(char *s);
extern void cleanup_line(Str s, int mode);
@@ -64,6 +73,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();
@@ -71,10 +92,8 @@ extern char *w3m_etc_dir();
extern char *w3m_conf_dir();
extern char *w3m_help_dir();
-#define New(type) ((type*)GC_MALLOC(sizeof(type)))
-#define NewAtom(type) ((type*)GC_MALLOC_ATOMIC(sizeof(type)))
-#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 */