Re: [HACKERS] contrib/fixchar (Was: Large databases, performance)
On 12 Oct 2002 at 8:54, Giles Lean wrote: Portable code uses 'unsigned char' when using ctype.h features, even though for many platforms where 'char' is an unsigned type it's not necessary for correct functioning. I don't see any isspace() or similar in the code though, so I'm not sure why this issue is being raised? Well, I commented on fixchar contrib module that it should use unsigned char rather than just char, to be on safer side on all platforms. Nothing much.. Bye Shridhar -- brokee, n: Someone who buys stocks on the advice of a broker. ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [HACKERS] contrib/fixchar (Was: Large databases, performance)
Giles Lean [EMAIL PROTECTED] writes: Portable code uses 'unsigned char' when using ctype.h features, even though for many platforms where 'char' is an unsigned type it's not necessary for correct functioning. Yup. Awhile back I went through the PG sources and made sure we explicitly casted the arguments of ctype.h functions to unsigned char if they weren't already. If anyone sees a place I missed (or that snuck in later) please speak up! I don't see any isspace() or similar in the code though, so I'm not sure why this issue is being raised? Ditto, I saw no ctype.h usage in Manfred's code. It matters not whether you label strcmp's argument as unsigned... regards, tom lane ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [HACKERS] contrib/fixchar (Was: Large databases, performance)
Well, this is not related to postgresql exactly but to summerise the problem, with libc patch PHCO_19090 or compatible upwards, on HP-UX11, isspace does not work correctly if input value is 127. o isspace() and such are defined in the standards to operate on characters o for historic C reasons, 'char' is widened to 'int' in function calls o it is platform dependent whether 'char' is a signed or unsigned type If your platform has signed 'char' (as HP-UX does on PA-RISC) and you pass a value that is negative it will be sign extended when converted to 'int', and may be outside the range of values for which isspace() is defined. Portable code uses 'unsigned char' when using ctype.h features, even though for many platforms where 'char' is an unsigned type it's not necessary for correct functioning. I don't see any isspace() or similar in the code though, so I'm not sure why this issue is being raised? Regards, Giles ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
[HACKERS] contrib/fixchar (Was: Large databases, performance)
On Wed, 09 Oct 2002 10:00:03 +0200, I wrote: here is an implementation of a set of user types: char3, char4, char10. New version available. As I don't want to spam the list with various versions until I get it right eventually, you can get it from http://members.aon.at/pivot/pg/fixchar20021010.tgz if you are interested. What's new: . README updated (per Shridhar's suggestion) . doesn't crash on NULL (p. Tom) . version-1 calling conventions (p. Tom) . isCachable (p. Tom) . works for 7.2 (as delivered) and for 7.3 (make for73) Shridhar, you were concerned about signed/unsigned chars; looking at the code I can not see how this is a problem. So no change in this regard. Thanks for your comments. Have fun! Servus Manfred ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [HACKERS] contrib/fixchar (Was: Large databases, performance)
On 10 Oct 2002 at 15:30, Manfred Koizar wrote: On Wed, 09 Oct 2002 10:00:03 +0200, I wrote: here is an implementation of a set of user types: char3, char4, char10. New version available. As I don't want to spam the list with various versions until I get it right eventually, you can get it from http://members.aon.at/pivot/pg/fixchar20021010.tgz if you are interested. What's new: . README updated (per Shridhar's suggestion) . doesn't crash on NULL (p. Tom) . version-1 calling conventions (p. Tom) . isCachable (p. Tom) . works for 7.2 (as delivered) and for 7.3 (make for73) Shridhar, you were concerned about signed/unsigned chars; looking at the code I can not see how this is a problem. So no change in this regard. Well, this is not related to postgresql exactly but to summerise the problem, with libc patch PHCO_19090 or compatible upwards, on HP-UX11, isspace does not work correctly if input value is 127. Can cause lot of problem for an external app. It works fine with unsigned char Does not make a difference from postgrersql point of view but would break non- english locale if they want to use this fix under some situation. But I agree, unless somebody reports it, no point fixing it and we know the fix anyway.. Bye Shridhar -- Live long and prosper. -- Spock, Amok Time, stardate 3372.7 ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])