Skip to content

Commit 45e6d1e

Browse files
committed
- MFH WS
1 parent 3493b07 commit 45e6d1e

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

main/snprintf.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c
156156
}
157157

158158
for (i = 0; i < ndigit && digits[i] != '\0'; i++);
159-
159+
160160
if ((decpt >= 0 && decpt - i > 4)
161161
|| (decpt < 0 && decpt < -3)) { /* use E-style */
162162
/* exponential format (e.g. 1.2345e+13) */
@@ -241,7 +241,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c
241241
* are met:
242242
*
243243
* 1. Redistributions of source code must retain the above copyright
244-
* notice, this list of conditions and the following disclaimer.
244+
* notice, this list of conditions and the following disclaimer.
245245
*
246246
* 2. Redistributions in binary form must reproduce the above copyright
247247
* notice, this list of conditions and the following disclaimer in
@@ -327,7 +327,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned,
327327
*is_negative = (num < 0);
328328

329329
/*
330-
* On a 2's complement machine, negating the most negative integer
330+
* On a 2's complement machine, negating the most negative integer
331331
* results in a number that cannot be represented as a signed integer.
332332
* Here is what we do to obtain the number's magnitude:
333333
* a. add 1 to the number
@@ -344,7 +344,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned,
344344
}
345345

346346
/*
347-
* We use a do-while loop so that we write at least 1 digit
347+
* We use a do-while loop so that we write at least 1 digit
348348
*/
349349
do {
350350
register u_wide_int new_magnitude = magnitude / 10;
@@ -763,7 +763,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
763763
fmt++;
764764
}
765765
/* these are promoted to int, so no break */
766-
default:
766+
default:
767767
modifier = LM_STD;
768768
break;
769769
}
@@ -961,7 +961,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
961961
pad_char = ' ';
962962
break;
963963

964-
964+
965965
case 'f':
966966
case 'F':
967967
case 'e':
@@ -1084,17 +1084,17 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
10841084
goto skip_output;
10851085

10861086
/*
1087-
* Always extract the argument as a "char *" pointer. We
1088-
* should be using "void *" but there are still machines
1087+
* Always extract the argument as a "char *" pointer. We
1088+
* should be using "void *" but there are still machines
10891089
* that don't understand it.
10901090
* If the pointer size is equal to the size of an unsigned
1091-
* integer we convert the pointer to a hex number, otherwise
1091+
* integer we convert the pointer to a hex number, otherwise
10921092
* we print "%p" to indicate that we don't handle "%p".
10931093
*/
10941094
case 'p':
10951095
if (sizeof(char *) <= sizeof(u_wide_int)) {
10961096
ui_num = (u_wide_int)((size_t) va_arg(ap, char *));
1097-
s = ap_php_conv_p2(ui_num, 4, 'x',
1097+
s = ap_php_conv_p2(ui_num, 4, 'x',
10981098
&num_buf[NUM_BUF_SIZE], &s_len);
10991099
if (ui_num != 0) {
11001100
*--s = 'x';
@@ -1152,7 +1152,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
11521152
PAD(min_width, s_len, pad_char);
11531153
}
11541154
/*
1155-
* Print the string s.
1155+
* Print the string s.
11561156
*/
11571157
for (i = s_len; i != 0; i--) {
11581158
INS_CHAR(*s, sp, bep, cc);

main/snprintf.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/*
2323
24-
Comparing: sprintf, snprintf, slprintf, spprintf
24+
Comparing: sprintf, snprintf, slprintf, spprintf
2525
2626
sprintf offers the ability to make a lot of failures since it does not know
2727
the size of the buffer it uses. Therefore usage of sprintf often
@@ -34,19 +34,19 @@ snprintf knows the buffers size and will not write behind it. But you will
3434
before beeing able to call the function. In other words you must
3535
be sure that you really know the maximum size of the buffer required.
3636
A bad thing is having a big maximum while in most cases you would
37-
only need a small buffer. If the size of the resulting string is
37+
only need a small buffer. If the size of the resulting string is
3838
longer or equal to the buffer size than the buffer is not terminated.
39-
The function also returns the number of chars not including the
39+
The function also returns the number of chars not including the
4040
terminating \0 that were needed to fully comply to the print request.
4141
42-
slprintf same as snprintf with the difference that it actually returns the
42+
slprintf same as snprintf with the difference that it actually returns the
4343
length printed not including the terminating \0.
4444
4545
spprintf is the dynamical version of snprintf. It allocates the buffer in size
4646
as needed and allows a maximum setting as snprintf (turn this feature
4747
off by setting max_len to 0). spprintf is a little bit slower than
48-
snprintf and offers possible memory leakes if you miss freeing the
49-
buffer allocated by the function. Therfore this function should be
48+
snprintf and offers possible memory leakes if you miss freeing the
49+
buffer allocated by the function. Therfore this function should be
5050
used where either no maximum is known or the maximum is much bigger
5151
than normal size required. spprintf allways terminates the buffer.
5252
@@ -61,8 +61,8 @@ spprintf is the dynamical version of snprintf. It allocates the buffer in size
6161
| | if (!buffer)
6262
| | return OUT_OF_MEMORY
6363
// sprintf allways terminates | // manual termination of | // spprintf allays terminates buffer
64-
// buffer | // buffer *IS* required |
65-
| buffer[MAX-1] = 0; |
64+
// buffer | // buffer *IS* required |
65+
| buffer[MAX-1] = 0; |
6666
action_with_buffer(buffer); | action_with_buffer(buffer); | action_with_buffer(buffer);
6767
| | efree(buffer);
6868
*/

main/spprintf.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* are met:
3131
*
3232
* 1. Redistributions of source code must retain the above copyright
33-
* notice, this list of conditions and the following disclaimer.
33+
* notice, this list of conditions and the following disclaimer.
3434
*
3535
* 2. Redistributions in binary form must reproduce the above copyright
3636
* notice, this list of conditions and the following disclaimer in
@@ -133,7 +133,7 @@
133133
#define INS_STRING(xbuf, s, slen) do { \
134134
smart_str_appendl(xbuf, s, slen); \
135135
} while (0)
136-
136+
137137
#define INS_CHAR(xbuf, ch) \
138138
INS_CHAR_NR(xbuf, ch)
139139

@@ -359,7 +359,7 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap)
359359
fmt++;
360360
}
361361
/* these are promoted to int, so no break */
362-
default:
362+
default:
363363
modifier = LM_STD;
364364
break;
365365
}
@@ -677,17 +677,17 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap)
677677
goto skip_output;
678678

679679
/*
680-
* Always extract the argument as a "char *" pointer. We
681-
* should be using "void *" but there are still machines
680+
* Always extract the argument as a "char *" pointer. We
681+
* should be using "void *" but there are still machines
682682
* that don't understand it.
683683
* If the pointer size is equal to the size of an unsigned
684-
* integer we convert the pointer to a hex number, otherwise
684+
* integer we convert the pointer to a hex number, otherwise
685685
* we print "%p" to indicate that we don't handle "%p".
686686
*/
687687
case 'p':
688688
if (sizeof(char *) <= sizeof(u_wide_int)) {
689689
ui_num = (u_wide_int)((size_t) va_arg(ap, char *));
690-
s = ap_php_conv_p2(ui_num, 4, 'x',
690+
s = ap_php_conv_p2(ui_num, 4, 'x',
691691
&num_buf[NUM_BUF_SIZE], &s_len);
692692
if (ui_num != 0) {
693693
*--s = 'x';
@@ -745,7 +745,7 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap)
745745
PAD(xbuf, min_width - s_len, pad_char);
746746
}
747747
/*
748-
* Print the string s.
748+
* Print the string s.
749749
*/
750750
INS_STRING(xbuf, s, s_len);
751751

@@ -767,14 +767,14 @@ PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap
767767
smart_str xbuf = {0};
768768

769769
xbuf_format_converter(&xbuf, format, ap);
770-
770+
771771
if (max_len && xbuf.len > max_len) {
772772
xbuf.len = max_len;
773773
}
774774
smart_str_0(&xbuf);
775-
775+
776776
*pbuf = xbuf.c;
777-
777+
778778
return xbuf.len;
779779
}
780780
/* }}} */

main/spprintf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
/* $Id$ */
2020

21-
/*
21+
/*
2222
2323
The pbuf parameter of all spprintf version receives a pointer to the allocated
2424
buffer. This buffer must be freed manually after usage using efree() function.

0 commit comments

Comments
 (0)