Re: Octstr support for converting to and from HTML 4 entities.

Oded Arbel <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization m-Wise mobile solutions
Message-ID <[email protected]>
You are write about the looping for ever - I actually didn't test the 
convert_from code (silly me :-) mostly as I don't use it (yet), but I should 
have tested it anyway. I'll rewrite it.

On Monday 23 September 2002 02:36, Rene Kluwen / Chimit Software Solutions 
wrote:

> In your html-entities.def I happened to notice that &amp; was missing!
> I don't know if that is on purpose, but if not: now you know ;)

No - its not on purpose. I created the def from an entity decleration DTD I 
found on w3c's site which contained only the high range entities. I later 
added the missing 4 low range entities - &amp; &quot; &gt; and &lt;. It'll be 
included in the resubmission. thanks for noticing.

> Anyhow... I came up with a faster version. That depends on
> html-entities.def being sorted on entity-name.

Thats is very nice. it does improve (heck - its a rewrite :-) on the what I 
wrote, and the convert_from() is very clean as I like it - but I do have some 
comments on the find_entiry():
- The sorting is not locale dependant, but character odinal value dependant - 
which is better, I think.
- I didn't understand this :
octstr_len(octstr_imm((entities[loop].entity_str))) 
except from some extra parenthesis, you are convering a c-string to octstr 
just to get its length ? strlen() does it faster.

> About being readable: the use of macro's and including an external
> file keeps being questionable to me as far as readability is
> concerned.

I can relate to that point of view, but it is tidy :-)

> But attached version is more efficient indeed. It uses the macro's in
> html-entities.def as well. But I tried to explain as much as possible
> in comments.

All in all - good looking piece of code. I'd like to reintegrate that into the 
patch, but modify the find_entity() a bit (reordering instructions mostly). 
may I ?

-- 
Oded Arbel
m-Wise mobile solutions
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.