Skip to content

Commit d433b79

Browse files
committed
Remove long unused code behind a #if 0
Author: Vignesh C <vignesh21@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CALDaNm3sn4yOq-4rogb-CfE0EYw6b3mVzz8+DnS9BNRwPnhngw@mail.gmail.com
1 parent 3b77dce commit d433b79

File tree

1 file changed

+0
-82
lines changed

1 file changed

+0
-82
lines changed

src/interfaces/ecpg/pgtypeslib/numeric.c

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -23,88 +23,6 @@
2323
} while (0)
2424

2525

26-
#if 0
27-
/* ----------
28-
* apply_typmod() -
29-
*
30-
* Do bounds checking and rounding according to the attributes
31-
* typmod field.
32-
* ----------
33-
*/
34-
static int
35-
apply_typmod(numeric *var, long typmod)
36-
{
37-
int precision;
38-
int scale;
39-
int maxweight;
40-
int i;
41-
42-
/* Do nothing if we have a default typmod (-1) */
43-
if (typmod < (long) (VARHDRSZ))
44-
return 0;
45-
46-
typmod -= VARHDRSZ;
47-
precision = (typmod >> 16) & 0xffff;
48-
scale = typmod & 0xffff;
49-
maxweight = precision - scale;
50-
51-
/* Round to target scale */
52-
i = scale + var->weight + 1;
53-
if (i >= 0 && var->ndigits > i)
54-
{
55-
int carry = (var->digits[i] > 4) ? 1 : 0;
56-
57-
var->ndigits = i;
58-
59-
while (carry)
60-
{
61-
carry += var->digits[--i];
62-
var->digits[i] = carry % 10;
63-
carry /= 10;
64-
}
65-
66-
if (i < 0)
67-
{
68-
var->digits--;
69-
var->ndigits++;
70-
var->weight++;
71-
}
72-
}
73-
else
74-
var->ndigits = Max(0, Min(i, var->ndigits));
75-
76-
/*
77-
* Check for overflow - note we can't do this before rounding, because
78-
* rounding could raise the weight. Also note that the var's weight could
79-
* be inflated by leading zeroes, which will be stripped before storage
80-
* but perhaps might not have been yet. In any case, we must recognize a
81-
* true zero, whose weight doesn't mean anything.
82-
*/
83-
if (var->weight >= maxweight)
84-
{
85-
/* Determine true weight; and check for all-zero result */
86-
int tweight = var->weight;
87-
88-
for (i = 0; i < var->ndigits; i++)
89-
{
90-
if (var->digits[i])
91-
break;
92-
tweight--;
93-
}
94-
95-
if (tweight >= maxweight && i < var->ndigits)
96-
{
97-
errno = PGTYPES_NUM_OVERFLOW;
98-
return -1;
99-
}
100-
}
101-
102-
var->rscale = scale;
103-
var->dscale = scale;
104-
return 0;
105-
}
106-
#endif
107-
10826
/* ----------
10927
* alloc_var() -
11028
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy