Skip to content

Commit 21664fb

Browse files
committed
Convert remaining K&R function declarations in libbcmath
These are already converted in 8.3. Backport minimal changes to 8.2, as the latest version of Clang on macOS has stopped supporting the K&R syntax. Closes GH-21636
1 parent 0f38bfd commit 21664fb

11 files changed

Lines changed: 14 additions & 52 deletions

File tree

ext/bcmath/libbcmath/src/add.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@
4242
N1 is added to N2 and the result placed into RESULT. SCALE_MIN
4343
is the minimum scale for the result. */
4444

45-
void
46-
bc_add (n1, n2, result, scale_min)
47-
bc_num n1, n2, *result;
48-
int scale_min;
45+
void bc_add(bc_num n1, bc_num n2, bc_num *result, int scale_min)
4946
{
5047
bc_num sum = NULL;
5148
int cmp_res;

ext/bcmath/libbcmath/src/compare.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@
4242
than N2 and +1 if N1 is greater than N2. If USE_SIGN is false, just
4343
compare the magnitudes. */
4444

45-
int
46-
_bc_do_compare (n1, n2, use_sign, ignore_last)
47-
bc_num n1, n2;
48-
int use_sign;
49-
int ignore_last;
45+
int _bc_do_compare(bc_num n1, bc_num n2, int use_sign, int ignore_last)
5046
{
5147
char *n1ptr, *n2ptr;
5248
int count;
@@ -151,9 +147,7 @@ _bc_do_compare (n1, n2, use_sign, ignore_last)
151147

152148
/* This is the "user callable" routine to compare numbers N1 and N2. */
153149

154-
int
155-
bc_compare (n1, n2)
156-
bc_num n1, n2;
150+
int bc_compare(bc_num n1, bc_num n2)
157151
{
158152
return _bc_do_compare (n1, n2, TRUE, FALSE);
159153
}

ext/bcmath/libbcmath/src/doaddsub.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@
4242
returned. The signs of N1 and N2 are ignored.
4343
SCALE_MIN is to set the minimum scale of the result. */
4444

45-
bc_num
46-
_bc_do_add (n1, n2, scale_min)
47-
bc_num n1, n2;
48-
int scale_min;
45+
bc_num _bc_do_add(bc_num n1, bc_num n2, int scale_min)
4946
{
5047
bc_num sum;
5148
int sum_scale, sum_digits;
@@ -134,10 +131,7 @@ _bc_do_add (n1, n2, scale_min)
134131
assumed to be larger than N2. SCALE_MIN is the minimum scale
135132
of the result. */
136133

137-
bc_num
138-
_bc_do_sub (n1, n2, scale_min)
139-
bc_num n1, n2;
140-
int scale_min;
134+
bc_num _bc_do_sub(bc_num n1, bc_num n2, int scale_min)
141135
{
142136
bc_num diff;
143137
int diff_scale, diff_len;

ext/bcmath/libbcmath/src/init.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939

4040
/* new_num allocates a number and sets fields to known values. */
4141

42-
bc_num
43-
_bc_new_num_ex (length, scale, persistent)
44-
int length, scale, persistent;
42+
bc_num _bc_new_num_ex(int length, int scale, int persistent)
4543
{
4644
bc_num temp;
4745
/* PHP Change: malloc() -> pemalloc(), removed free_list code */
@@ -61,10 +59,7 @@ _bc_new_num_ex (length, scale, persistent)
6159
/* "Frees" a bc_num NUM. Actually decreases reference count and only
6260
frees the storage if reference count is zero. */
6361

64-
void
65-
_bc_free_num_ex (num, persistent)
66-
bc_num *num;
67-
int persistent;
62+
void _bc_free_num_ex(bc_num *num, int persistent)
6863
{
6964
if (*num == NULL) return;
7065
(*num)->n_refs--;

ext/bcmath/libbcmath/src/int2num.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@
4040

4141
/* Convert an integer VAL to a bc number NUM. */
4242

43-
void
44-
bc_int2num (num, val)
45-
bc_num *num;
46-
int val;
43+
void bc_int2num(bc_num *num, int val)
4744
{
4845
char buffer[30];
4946
char *bptr, *vptr;

ext/bcmath/libbcmath/src/nearzero.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@
4141
Specifically, all but the last digit is 0 and the last digit is 1.
4242
Last digit is defined by scale. */
4343

44-
char
45-
bc_is_near_zero (num, scale)
46-
bc_num num;
47-
int scale;
44+
char bc_is_near_zero(bc_num num, int scale)
4845
{
4946
int count;
5047
char *nptr;

ext/bcmath/libbcmath/src/neg.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939

4040
/* In some places we need to check if the number is negative. */
4141

42-
char
43-
bc_is_neg (num)
44-
bc_num num;
42+
char bc_is_neg(bc_num num)
4543
{
4644
return num->n_sign == MINUS;
4745
}

ext/bcmath/libbcmath/src/num2long.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@
4242
a long, this function returns a zero. This can be detected by checking
4343
the NUM for zero after having a zero returned. */
4444

45-
long
46-
bc_num2long (num)
47-
bc_num num;
45+
long bc_num2long(bc_num num)
4846
{
4947
long val;
5048
char *nptr;

ext/bcmath/libbcmath/src/num2str.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@
3939

4040
/* Convert a numbers to a string. Base 10 only.*/
4141

42-
zend_string
43-
*bc_num2str_ex (num, scale)
44-
bc_num num;
45-
int scale;
42+
zend_string *bc_num2str_ex(bc_num num, int scale)
4643
{
4744
zend_string *str;
4845
char *sptr;

ext/bcmath/libbcmath/src/rmzero.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
_bc_rm_leading_zeros just moves the data "value" pointer to the
4242
correct place and adjusts the length. */
4343

44-
void
45-
_bc_rm_leading_zeros (num)
46-
bc_num num;
44+
void _bc_rm_leading_zeros(bc_num num)
4745
{
4846
/* We can move n_value to point to the first non zero digit! */
4947
while (*num->n_value == 0 && num->n_len > 1) {

0 commit comments

Comments
 (0)