From: | "Joel Jacobson" <joel(at)compiler(dot)org> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | [PATCH] FIx alloc_var() ndigits thinko |
Date: | 2023-02-15 21:08:59 |
Message-ID: | ea480513-371c-4b55-8f23-a7c5e7727ae8@app.fastmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I came across another harmless thinko in numeric.c.
It is harmless since 20/DEC_DIGITS and 40/DEC_DIGITS happens to be exactly 5 and 10 since DEC_DIGITS == 4,
but should be fixed anyway for correctness IMO.
- alloc_var(var, 20 / DEC_DIGITS);
+ alloc_var(var, (20 + DEC_DIGITS - 1) / DEC_DIGITS);
- alloc_var(var, 40 / DEC_DIGITS);
+ alloc_var(var, (40 + DEC_DIGITS - 1) / DEC_DIGITS);
/Joel
Attachment | Content-Type | Size |
---|---|---|
0001-fix-alloc-var-ndigits-thinko.patch | application/octet-stream | 788 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | David Zhang | 2023-02-15 21:31:05 | Re: psql: Add role's membership options to the \du+ command |
Previous Message | Jelte Fennema | 2023-02-15 21:00:41 | Re: run pgindent on a regular basis / scripted manner |