- Notifications
You must be signed in to change notification settings - Fork28
Commit786b180
committed
The pg_atoi() function uses strtol() to convert the string to numbers. Some
implementations of strtol() treat empty strings ("") as invalid argumentswhile others convert this (erroneously, IHMO) to zero (0). Assuming that theexpected behaviour of pg_atoi() is to return 0 if it is passed an emptystring, I am supplying the following patch to explictly check for an emptystring in pg_atoi() and return 0 if the string is empty. The patch will alsotrap a NULL character pointer being passed to pg_atoi() and will use elog() toprint out an error message if the input char pointer is NULL.Billy G. Allie1 parent5f7fb67 commit786b180
1 file changed
+14
-3
lines changedLines changed: 14 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
58 |
| - | |
59 |
| - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
60 | 71 |
| |
61 | 72 |
| |
62 | 73 |
| |
|
0 commit comments
Comments
(0)