Skip to content

Commit 43b31fd

Browse files
committed
pp_pack.c: White-space, add braces only
Change a few lines that affect the next commits that use a coding style not conforming to current expectations And also add some blank lines to serve as "paragraph" markers between code segments, and change the indentation of a few lines in preparation for blocks being added and removed in the next commits.
1 parent 0eceef0 commit 43b31fd

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

pp_pack.c

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -287,22 +287,25 @@ S_utf8_to_bytes(pTHX_ const char **s, const char *end, const char *buf, SSize_t
287287
if (UNLIKELY(needs_swap))
288288
buf += buf_len;
289289

290-
for (;buf_len > 0; buf_len--) {
290+
for (; buf_len > 0; buf_len--) {
291291
if (from >= end) return FALSE;
292292
val = utf8n_to_uvchr((U8 *) from, end-from, &retlen, flags);
293293
if (retlen == (STRLEN) -1) {
294294
from += UTF8_SAFE_SKIP(from, end);
295295
bad |= 1;
296296
} else from += retlen;
297-
if (val >= 0x100) {
298-
bad |= 2;
299-
val = (U8) val;
300-
}
297+
298+
if (val >= 0x100) {
299+
bad |= 2;
300+
val = (U8) val;
301+
}
302+
301303
if (UNLIKELY(needs_swap))
302304
*(U8 *)--buf = (U8)val;
303305
else
304306
*(U8 *)buf++ = (U8)val;
305307
}
308+
306309
/* We have enough characters for the buffer. Did we have problems ? */
307310
if (bad) {
308311
if (bad & 1) {
@@ -315,13 +318,15 @@ S_utf8_to_bytes(pTHX_ const char **s, const char *end, const char *buf, SSize_t
315318
}
316319
if (from > end) from = end;
317320
}
318-
if ((bad & 2))
319-
ck_warner(packWARN(datumtype & TYPE_IS_PACK ?
320-
WARN_PACK : WARN_UNPACK),
321-
"Character(s) in '%c' format wrapped in %s",
322-
(int) TYPE_NO_MODIFIERS(datumtype),
323-
datumtype & TYPE_IS_PACK ? "pack" : "unpack");
321+
322+
if ((bad & 2))
323+
ck_warner(packWARN(datumtype & TYPE_IS_PACK ?
324+
WARN_PACK : WARN_UNPACK),
325+
"Character(s) in '%c' format wrapped in %s",
326+
(int) TYPE_NO_MODIFIERS(datumtype),
327+
datumtype & TYPE_IS_PACK ? "pack" : "unpack");
324328
}
329+
325330
*s = from;
326331
return TRUE;
327332
}
@@ -1230,17 +1235,17 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
12301235
case 'c':
12311236
while (len-- > 0 && s < strend) {
12321237
int aint;
1233-
if (utf8)
1234-
{
1238+
if (utf8) {
12351239
STRLEN retlen;
12361240
aint = utf8n_to_uvchr((U8 *) s, strend-s, &retlen,
12371241
ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
12381242
if (retlen == (STRLEN) -1)
12391243
croak("Malformed UTF-8 string in unpack");
12401244
s += retlen;
1241-
}
1242-
else
1243-
aint = *(U8 *)(s)++;
1245+
}
1246+
else {
1247+
aint = *(U8 *)(s)++;
1248+
}
12441249
if (aint >= 128 && datumtype != 'C') /* fake up signed chars */
12451250
aint -= 256;
12461251
if (!checksum)
@@ -1310,11 +1315,16 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
13101315
break;
13111316
len = UTF8SKIP(result);
13121317
if (!S_utf8_to_bytes(aTHX_ &ptr, strend,
1313-
(char *) &result[1], len-1, 'U')) break;
1318+
(char *) &result[1], len - 1, 'U'))
1319+
{
1320+
break;
1321+
}
1322+
13141323
auv = utf8n_to_uvchr(result, len, &retlen,
13151324
UTF8_ALLOW_DEFAULT);
13161325
s = ptr;
1317-
} else {
1326+
}
1327+
else {
13181328
auv = utf8n_to_uvchr((U8*)s, strend - s, &retlen,
13191329
UTF8_ALLOW_DEFAULT);
13201330
if (retlen == (STRLEN) -1)

0 commit comments

Comments
 (0)