Re: Octstr support for converting to and from HTML 4 entities.
Rene Kluwen <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <1032782128.19672.5.camel@paraweb> |
> strlen() does it faster. I am making an immutable octetstring, just for the sake of not having to use strlen. Since I got commented before that the string functions in C were a bad thing. There was no other reason. Change at will. > 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 ? No prob... It is what I posted it for :)... -- Rene... On Mon, 2002-09-23 at 12:18, Oded Arbel wrote: > > 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 & 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 - & " > and <. 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 > >