cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Porting to OS/400: new patch

From: Patrick Monnerat <Patrick.Monnerat_at_datasphere.ch>
Date: Tue, 24 Jul 2007 13:02:29 +0200

> Some of the new initialized arrays (valchars, setstroffsets) should be
marked as 'const'. And there's a great opportunity for abstraction by
creating a Curl_isalnum macro. You might even be able to rework it so it
could be used in get_char instead of the valchars array, speeding it up
at the same time.

Hard to implement Curl_isalnum in a portable way as a unique macro
because in EBCDIC, 'z' - 'a' != 25. Implementations would have to define
it in an OS dependent way. Hard to implement it portably as a fast
procedure too if targeted method is table indexing by character code!
The only way I see to speed up a bit the valchar search code is to use
strchr(). The multi-case switch in escape.c seems to me optimal (with
respect to portability) since it is handled (and maybe optimised) by the
target system compiler.

> The dynamic option string parts might be able to be simplified by
unconditionally strdup'ing (or the equivalent) all string options on all
platforms, instead of keeping track of what has and hasn't been dup'ed.

This would simplify the OS400 EBCDIC wrappers too... I implemented the
"is_allocated" stategy to respect the current package behavior on other
platforms. If you agree, I can write the code for unconditional
strdup'ing...

Many thanks for all your reviews
Received on 2007-07-24