mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
Use ControlStatementsExceptControlMacros for SpaceBeforeParens
> Put a space before opening parentheses only after control statement > keywords (for/if/while...) except this option doesn’t apply to ForEach > and If macros. This is useful in projects where ForEach/If macros are > treated as function calls instead of control statements. (cherry picked from commit 42496f3f4a8802c0ba8033a1bcabc8bebf5b0087)
This commit is contained in:
parent
a464171243
commit
8339615235
@ -79,3 +79,4 @@ Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
RemoveParentheses: ReturnStatement
|
||||
RemoveSemicolon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||
|
@ -67,3 +67,4 @@ Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
RemoveParentheses: ReturnStatement
|
||||
RemoveSemicolon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||
|
@ -87,8 +87,9 @@ sched_affinity_ncpus(void) {
|
||||
int i, n = 0;
|
||||
|
||||
for (i = 0; i < CPU_SETSIZE; ++i) {
|
||||
if (CPU_ISSET(i, &cpus))
|
||||
if (CPU_ISSET(i, &cpus)) {
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
#endif
|
||||
@ -115,8 +116,9 @@ cpuset_affinity_ncpus(void) {
|
||||
if (result != -1) {
|
||||
int i, n = 0;
|
||||
for (i = 0; i < CPU_SETSIZE; ++i) {
|
||||
if (CPU_ISSET(i, &cpus))
|
||||
if (CPU_ISSET(i, &cpus)) {
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
@ -612,8 +612,9 @@ phr_decode_chunked(struct phr_chunked_decoder *decoder, char *buf,
|
||||
case CHUNKED_IN_CHUNK_SIZE:
|
||||
for (;; ++src) {
|
||||
int v;
|
||||
if (src == bufsz)
|
||||
if (src == bufsz) {
|
||||
goto Exit;
|
||||
}
|
||||
if ((v = decode_hex(buf[src])) == -1) {
|
||||
if (decoder->_hex_count == 0) {
|
||||
ret = -1;
|
||||
@ -650,10 +651,12 @@ phr_decode_chunked(struct phr_chunked_decoder *decoder, char *buf,
|
||||
/* RFC 7230 A.2 "Line folding in chunk extensions is
|
||||
* disallowed" */
|
||||
for (;; ++src) {
|
||||
if (src == bufsz)
|
||||
if (src == bufsz) {
|
||||
goto Exit;
|
||||
if (buf[src] == '\012')
|
||||
}
|
||||
if (buf[src] == '\012') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
++src;
|
||||
if (decoder->bytes_left_in_chunk == 0) {
|
||||
@ -670,16 +673,18 @@ phr_decode_chunked(struct phr_chunked_decoder *decoder, char *buf,
|
||||
case CHUNKED_IN_CHUNK_DATA: {
|
||||
size_t avail = bufsz - src;
|
||||
if (avail < decoder->bytes_left_in_chunk) {
|
||||
if (dst != src)
|
||||
if (dst != src) {
|
||||
memmove(buf + dst, buf + src, avail);
|
||||
}
|
||||
src += avail;
|
||||
dst += avail;
|
||||
decoder->bytes_left_in_chunk -= avail;
|
||||
goto Exit;
|
||||
}
|
||||
if (dst != src)
|
||||
if (dst != src) {
|
||||
memmove(buf + dst, buf + src,
|
||||
decoder->bytes_left_in_chunk);
|
||||
}
|
||||
src += decoder->bytes_left_in_chunk;
|
||||
dst += decoder->bytes_left_in_chunk;
|
||||
decoder->bytes_left_in_chunk = 0;
|
||||
@ -688,10 +693,12 @@ phr_decode_chunked(struct phr_chunked_decoder *decoder, char *buf,
|
||||
/* fallthru */
|
||||
case CHUNKED_IN_CHUNK_CRLF:
|
||||
for (;; ++src) {
|
||||
if (src == bufsz)
|
||||
if (src == bufsz) {
|
||||
goto Exit;
|
||||
if (buf[src] != '\015')
|
||||
}
|
||||
if (buf[src] != '\015') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (buf[src] != '\012') {
|
||||
ret = -1;
|
||||
@ -702,21 +709,26 @@ phr_decode_chunked(struct phr_chunked_decoder *decoder, char *buf,
|
||||
break;
|
||||
case CHUNKED_IN_TRAILERS_LINE_HEAD:
|
||||
for (;; ++src) {
|
||||
if (src == bufsz)
|
||||
if (src == bufsz) {
|
||||
goto Exit;
|
||||
if (buf[src] != '\015')
|
||||
}
|
||||
if (buf[src] != '\015') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (buf[src++] == '\012')
|
||||
if (buf[src++] == '\012') {
|
||||
goto Complete;
|
||||
}
|
||||
decoder->_state = CHUNKED_IN_TRAILERS_LINE_MIDDLE;
|
||||
/* fallthru */
|
||||
case CHUNKED_IN_TRAILERS_LINE_MIDDLE:
|
||||
for (;; ++src) {
|
||||
if (src == bufsz)
|
||||
if (src == bufsz) {
|
||||
goto Exit;
|
||||
if (buf[src] == '\012')
|
||||
}
|
||||
if (buf[src] == '\012') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
++src;
|
||||
decoder->_state = CHUNKED_IN_TRAILERS_LINE_HEAD;
|
||||
@ -729,8 +741,9 @@ phr_decode_chunked(struct phr_chunked_decoder *decoder, char *buf,
|
||||
Complete:
|
||||
ret = bufsz - src;
|
||||
Exit:
|
||||
if (dst != src)
|
||||
if (dst != src) {
|
||||
memmove(buf + dst, buf + src, bufsz - src);
|
||||
}
|
||||
*_bufsz = dst;
|
||||
/* if incomplete but the overhead of the chunked encoding is >=100KB and
|
||||
* >80%, signal an error */
|
||||
|
@ -125,11 +125,13 @@ strnstr(const char *s, const char *find, size_t slen) {
|
||||
len = strlen(find);
|
||||
do {
|
||||
do {
|
||||
if (slen-- < 1 || (sc = *s++) == '\0')
|
||||
if (slen-- < 1 || (sc = *s++) == '\0') {
|
||||
return NULL;
|
||||
}
|
||||
} while (sc != c);
|
||||
if (len > slen)
|
||||
if (len > slen) {
|
||||
return NULL;
|
||||
}
|
||||
} while (strncmp(s, find, len) != 0);
|
||||
s--;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user