diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2003-02-05 02:18:27 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2003-02-05 02:18:27 -0500 |
commit | c812b42f4248ea1ab6641616f6aef08d402d9f92 (patch) | |
tree | f3a1dc7217619392dcbffcfe58840ba92b84436d /WWW/Library/Implementation/SGML.c | |
parent | 533c7482785176296637df81cd1a6318a0c29f97 (diff) | |
download | lynx-snapshots-c812b42f4248ea1ab6641616f6aef08d402d9f92.tar.gz |
snapshot of project "lynx", label v2-8-5dev_14
Diffstat (limited to 'WWW/Library/Implementation/SGML.c')
-rw-r--r-- | WWW/Library/Implementation/SGML.c | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index 4c8062f0..4c3b3b5a 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -60,19 +60,36 @@ PRIVATE void fake_put_character ARGS2( #endif - /* will use an inlined version */ -#ifdef USE_INLINE_PUTC + /* will use partially inlined version */ +#define orig_HTChunkPutUtf8Char HTChunkPutUtf8Char +#undef HTChunkPutUtf8Char + +/* ...used for comments and attributes value like href... */ +#define HTChunkPutUtf8Char(ch,x) \ + { \ + if ((TOASCII(x) < 128) && (ch->size < ch->allocated)) \ + ch->data[ch->size++] = (char)x; \ + else \ + orig_HTChunkPutUtf8Char(ch,x); \ + } + +#if 0 +#define orig_HTChunkPutc HTChunkPutc #undef HTChunkPutc -#define HTChunkPutc(ch,c)\ - if (ch->size >= ch->allocated) {\ - ch->allocated = ch->allocated + ch->growby;\ - ch->data = ch->data ? (char *)realloc(ch->data, ch->allocated)\ - : typecallocn(char, ch->allocated);\ - if (!ch->data)\ - outofmem(__FILE__, "HTChunkPutc");\ - }\ - ch->data[ch->size++] = c; -#endif + +#define HTChunkPutc(ch,x) \ + { \ + if (ch->size < ch->allocated) \ + ch->data[ch->size++] = x; \ + else \ + orig_HTChunkPutc(ch,x); \ + } + +#undef HTChunkTerminate + +#define HTChunkTerminate(ch) \ + HTChunkPutc(ch, (char)0) +#endif /* */ #define PUTS(str) ((*context->actions->put_string)(context->target, str)) #define PUTC(ch) ((*context->actions->put_character)(context->target, ch)) @@ -277,7 +294,7 @@ PRIVATE char *state_name ARGS1(sgml_state, n) static HTElement pool[DEPTH]; static int depth = 0; -PRIVATE HTElement* pool_get NOARGS +PRIVATE HTElement* pool_alloc NOARGS { depth++; if (depth > DEPTH) @@ -1332,7 +1349,7 @@ PRIVATE void start_element ARGS1( if (status == HT_PARSER_OTHER_CONTENT) new_tag = ALT_TAGP(new_tag); /* this is only returned for OBJECT */ if (new_tag->contents != SGML_EMPTY) { /* i.e., tag not empty */ - HTElement * N = pool_get(); + HTElement * N = pool_alloc(); if (N == NULL) outofmem(__FILE__, "start_element"); N->next = context->element_stack; |