Skip to content

Commit 080ca88

Browse files
committed
Remove artificial C89 support scopes
1 parent 50c43c3 commit 080ca88

18 files changed

Lines changed: 8 additions & 87 deletions

src/UriCommon.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ static UriBool URI_FUNC(PrependNewDotSegment)(URI_TYPE(Uri) * uri,
671671
assert(uri != NULL);
672672
assert(memory != NULL);
673673

674-
{
675674
URI_TYPE(PathSegment) * const segment =
676675
memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
677676

@@ -681,7 +680,6 @@ static UriBool URI_FUNC(PrependNewDotSegment)(URI_TYPE(Uri) * uri,
681680

682681
segment->next = uri->pathHead;
683682

684-
{
685683
URI_TYPE(TextRange) dotRange;
686684
dotRange.first = URI_FUNC(ConstPwd);
687685
dotRange.afterLast = URI_FUNC(ConstPwd) + 1;
@@ -695,10 +693,8 @@ static UriBool URI_FUNC(PrependNewDotSegment)(URI_TYPE(Uri) * uri,
695693
} else {
696694
segment->text = dotRange; /* copies all members */
697695
}
698-
}
699696

700697
uri->pathHead = segment;
701-
}
702698

703699
return URI_TRUE;
704700
}
@@ -730,7 +726,6 @@ UriBool URI_FUNC(FixPathNoScheme)(URI_TYPE(Uri) * uri, UriMemoryManager * memory
730726
}
731727

732728
/* Check for troublesome first path segment containing a colon */
733-
{
734729
UriBool colonFound = URI_FALSE;
735730
const URI_CHAR * walker = uri->pathHead->text.first;
736731

@@ -747,7 +742,6 @@ UriBool URI_FUNC(FixPathNoScheme)(URI_TYPE(Uri) * uri, UriMemoryManager * memory
747742
if (colonFound == URI_FALSE) {
748743
return URI_TRUE; /* i.e. nothing to do */
749744
}
750-
}
751745

752746
/* Insert "." segment in front */
753747
return URI_FUNC(PrependNewDotSegment)(uri, memory);

src/UriFile.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ static URI_INLINE int URI_FUNC(UriStringToFilename)(const URI_CHAR * uriString,
140140
return URI_ERROR_NULL;
141141
}
142142

143-
{
144143
const UriBool file_unknown_slashes =
145144
URI_STRNCMP(uriString, _UT("file:"), URI_STRLEN(_UT("file:"))) == 0;
146145
const UriBool file_one_or_more_slashes =
@@ -189,7 +188,6 @@ static URI_INLINE int URI_FUNC(UriStringToFilename)(const URI_CHAR * uriString,
189188

190189
memcpy(unescape_target, uriString + charsToSkip, charsToCopy * sizeof(URI_CHAR));
191190
URI_FUNC(UnescapeInPlaceEx)(filename, URI_FALSE, URI_BR_DONT_TOUCH);
192-
}
193191

194192
/* Convert forward slashes to backslashes */
195193
if (!toUnix) {

src/UriMemory.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ int uriTestMemoryManagerEx(UriMemoryManager * memory, UriBool challengeAlignment
436436
ptr[2] = 2.2L;
437437
ptr[3] = 3.3L;
438438

439-
{
440439
long double * const ptrNew =
441440
memory->realloc(memory, ptr, 8 * sizeof(long double));
442441
if (ptrNew != NULL) {
@@ -446,7 +445,6 @@ int uriTestMemoryManagerEx(UriMemoryManager * memory, UriBool challengeAlignment
446445
ptr[6] = 6.6L;
447446
ptr[7] = 7.7L;
448447
}
449-
}
450448

451449
memory->free(memory, ptr);
452450
}

src/UriNormalize.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ static const URI_CHAR * URI_FUNC(PastLeadingZeros)(const URI_CHAR * first,
524524
assert(afterLast != NULL);
525525
assert(first != afterLast);
526526

527-
{
528527
/* Find the first non-zero character */
529528
const URI_CHAR * remainderFirst = first;
530529
while ((remainderFirst < afterLast) && (remainderFirst[0] == _UT('0'))) {
@@ -541,7 +540,6 @@ static const URI_CHAR * URI_FUNC(PastLeadingZeros)(const URI_CHAR * first,
541540
}
542541

543542
return remainderFirst;
544-
}
545543
}
546544

547545
static void URI_FUNC(DropLeadingZerosInplace)(URI_CHAR * first,
@@ -554,7 +552,6 @@ static void URI_FUNC(DropLeadingZerosInplace)(URI_CHAR * first,
554552
return;
555553
}
556554

557-
{
558555
const URI_CHAR * const remainderFirst =
559556
URI_FUNC(PastLeadingZeros)(first, *afterLast);
560557

@@ -564,7 +561,6 @@ static void URI_FUNC(DropLeadingZerosInplace)(URI_CHAR * first,
564561
first[remainderLen] = _UT('\0');
565562
*afterLast = first + remainderLen;
566563
}
567-
}
568564
}
569565

570566
static void URI_FUNC(AdvancePastLeadingZeros)(const URI_CHAR ** first,
@@ -577,13 +573,11 @@ static void URI_FUNC(AdvancePastLeadingZeros)(const URI_CHAR ** first,
577573
return;
578574
}
579575

580-
{
581576
const URI_CHAR * const remainderFirst =
582577
URI_FUNC(PastLeadingZeros)(*first, afterLast);
583578

584579
/* Cut off leading zeros */
585580
*first = remainderFirst;
586-
}
587581
}
588582

589583
static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,

src/UriParse.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,14 +1361,12 @@ static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * s
13611361

13621362
case _UT('%'):
13631363
state->uri->portText.first = NULL; /* Not a port, reset */
1364-
{
13651364
const URI_CHAR * const afterPct =
13661365
URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
13671366
if (afterPct == NULL) {
13681367
return NULL;
13691368
}
13701369
return URI_FUNC(ParseOwnUserInfo)(state, afterPct, afterLast, memory);
1371-
}
13721370

13731371
case _UT('@'):
13741372
state->uri->hostText.afterLast = NULL; /* Not a host, reset */

src/UriRecompose.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
520520
/* clang-format off */
521521
/* [13/19] append query to result; */
522522
/* clang-format on */
523-
{
524523
const int charsToWrite =
525524
(int)(uri->query.afterLast - uri->query.first);
526525
if (dest != NULL) {
@@ -538,7 +537,6 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
538537
} else {
539538
(*charsRequired) += charsToWrite;
540539
}
541-
}
542540
/* clang-format off */
543541
/* [14/19] endif; */
544542
/* clang-format on */
@@ -567,7 +565,6 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
567565
/* clang-format off */
568566
/* [17/19] append fragment to result; */
569567
/* clang-format on */
570-
{
571568
const int charsToWrite =
572569
(int)(uri->fragment.afterLast - uri->fragment.first);
573570
if (dest != NULL) {
@@ -585,7 +582,6 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
585582
} else {
586583
(*charsRequired) += charsToWrite;
587584
}
588-
}
589585
/* clang-format off */
590586
/* [18/19] endif; */
591587
/* clang-format on */

src/UriSetFragment.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ int URI_FUNC(SetFragmentMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
254254
assert(uri->owner == URI_TRUE);
255255

256256
/* Apply new value */
257-
{
258257
URI_TYPE(TextRange) sourceRange;
259258
sourceRange.first = first;
260259
sourceRange.afterLast = afterLast;
@@ -263,7 +262,6 @@ int URI_FUNC(SetFragmentMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
263262
== URI_FALSE) {
264263
return URI_ERROR_MALLOC;
265264
}
266-
}
267265

268266
return URI_SUCCESS;
269267
}

src/UriSetHostAuto.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ int URI_FUNC(SetHostAutoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
8080
}
8181

8282
/* Auto-detect type and then apply */
83-
{
8483
UriHostType hostType;
8584

8685
/* IPv6 or IPvFuture? */
@@ -115,7 +114,6 @@ int URI_FUNC(SetHostAutoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
115114
}
116115

117116
return URI_FUNC(InternalSetHostMm)(uri, hostType, first, afterLast, memory);
118-
}
119117
}
120118

121119
int URI_FUNC(SetHostAuto)(URI_TYPE(Uri) * uri, const URI_CHAR * first,

src/UriSetHostCommon.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
131131
}
132132
}
133133

134-
{
135134
/* Clear old value */
136135
const UriBool hadHostBefore = URI_FUNC(HasHost)(uri);
137136
if (uri->hostData.ipFuture.first != NULL) {
@@ -169,16 +168,13 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
169168
if (hadHostBefore == URI_TRUE) {
170169
uri->absolutePath = URI_TRUE;
171170

172-
{
173171
const UriBool success =
174172
URI_FUNC(EnsureThatPathIsNotMistakenForHost)(uri, memory);
175173
return (success == URI_TRUE) ? URI_SUCCESS : URI_ERROR_MALLOC;
176-
}
177174
}
178175

179176
return URI_SUCCESS;
180177
}
181-
}
182178

183179
assert(first != NULL);
184180

@@ -193,7 +189,6 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
193189
assert(uri->owner == URI_TRUE);
194190

195191
/* Apply new value; NOTE that .hostText is set for all four host types */
196-
{
197192
URI_TYPE(TextRange) sourceRange;
198193
sourceRange.first = first;
199194
sourceRange.afterLast = afterLast;
@@ -213,7 +208,6 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
213208
return URI_ERROR_MALLOC;
214209
}
215210

216-
{
217211
const int res = URI_FUNC(ParseIpFourAddress)(uri->hostData.ip4->data,
218212
first, afterLast);
219213
# if defined(NDEBUG)
@@ -222,15 +216,13 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
222216
assert(res
223217
== URI_SUCCESS); /* because checked for well-formedness earlier */
224218
# endif
225-
}
226219
} break;
227220
case URI_HOST_TYPE_IP6: {
228221
uri->hostData.ip6 = memory->malloc(memory, sizeof(UriIp6));
229222
if (uri->hostData.ip6 == NULL) {
230223
return URI_ERROR_MALLOC;
231224
}
232225

233-
{
234226
const int res = URI_FUNC(ParseIpSixAddressMm)(uri->hostData.ip6, first,
235227
afterLast, memory);
236228
assert((res == URI_SUCCESS)
@@ -239,7 +231,6 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
239231
if (res != URI_SUCCESS) {
240232
return res;
241233
}
242-
}
243234
} break;
244235
case URI_HOST_TYPE_IPFUTURE:
245236
uri->hostData.ipFuture.first = uri->hostText.first;
@@ -250,7 +241,6 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
250241
default:
251242
assert(0 && "Unsupported URI host type");
252243
}
253-
}
254244

255245
return URI_SUCCESS;
256246
}

src/UriSetHostIp4.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,11 @@ UriBool URI_FUNC(IsWellFormedHostIp4)(const URI_CHAR * first,
7272
return URI_FALSE;
7373
}
7474

75-
{
7675
unsigned char octetOutput[4];
7776
return (URI_FUNC(ParseIpFourAddress)(octetOutput, first, afterLast)
7877
== URI_SUCCESS)
7978
? URI_TRUE
8079
: URI_FALSE;
81-
}
8280
}
8381

8482
int URI_FUNC(SetHostIp4Mm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,

0 commit comments

Comments
 (0)