"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "doc/coding-style.txt" between
haproxy-2.0.13.tar.gz and haproxy-2.0.14.tar.gz

About: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments. LTS (Long-Term Support) release.

coding-style.txt  (haproxy-2.0.13):coding-style.txt  (haproxy-2.0.14)
skipping to change at line 112 skipping to change at line 112
If we take again the example above marking tabs with "[-Tabs-]" and spaces If we take again the example above marking tabs with "[-Tabs-]" and spaces
with "#", we get this : with "#", we get this :
| [-Tabs-]if ((len < eol - sol) && | [-Tabs-]if ((len < eol - sol) &&
| [-Tabs-]####(sol[len] == ':') && | [-Tabs-]####(sol[len] == ':') &&
| [-Tabs-]####(strncasecmp(sol, name, len) == 0)) { | [-Tabs-]####(strncasecmp(sol, name, len) == 0)) {
| [-Tabs-][-Tabs-]ctx->del = len; | [-Tabs-][-Tabs-]ctx->del = len;
| [-Tabs-]} | [-Tabs-]}
It is worth noting that some editors tend to confuse indentations and aligment. It is worth noting that some editors tend to confuse indentations and alignment.
Emacs is notoriously known for this brokenness, and is responsible for almost Emacs is notoriously known for this brokenness, and is responsible for almost
all of the alignment mess. The reason is that Emacs only counts spaces, tries all of the alignment mess. The reason is that Emacs only counts spaces, tries
to fill as many as possible with tabs and completes with spaces. Once you know to fill as many as possible with tabs and completes with spaces. Once you know
it, you just have to be careful, as alignment is not used much, so generally it it, you just have to be careful, as alignment is not used much, so generally it
is just a matter of replacing the last tab with 8 spaces when this happens. is just a matter of replacing the last tab with 8 spaces when this happens.
Indentation should be used everywhere there is a block or an opening brace. It Indentation should be used everywhere there is a block or an opening brace. It
is not possible to have two consecutive closing braces on the same column, it is not possible to have two consecutive closing braces on the same column, it
means that the innermost was not indented. means that the innermost was not indented.
skipping to change at line 1206 skipping to change at line 1206
| { | {
| int ret = 0; /* initialize ret */ | int ret = 0; /* initialize ret */
| if (x >> 4) { x >>= 4; ret += 4; } /* add 4 to ret if needed */ | if (x >> 4) { x >>= 4; ret += 4; } /* add 4 to ret if needed */
| return ret + ((0xFFFFAA50U >> (x << 1)) & 3) + 1; /* add ??? */ | return ret + ((0xFFFFAA50U >> (x << 1)) & 3) + 1; /* add ??? */
| } | }
| ... | ...
| bit = ~len + (skip << 3) + 9; /* update bit */ | bit = ~len + (skip << 3) + 9; /* update bit */
Right use of comments : Right use of comments :
| /* This function returns the positoin of the highest bit set in the lowest | /* This function returns the position of the highest bit set in the lowest
| * byte of <x>, between 0 and 7. It only works if <x> is non-null. It uses | * byte of <x>, between 0 and 7. It only works if <x> is non-null. It uses
| * a 32-bit value as a lookup table to return one of 4 values for the | * a 32-bit value as a lookup table to return one of 4 values for the
| * highest 16 possible 4-bit values. | * highest 16 possible 4-bit values.
| */ | */
| int flsnz8(unsigned int x) | int flsnz8(unsigned int x)
| { | {
| int ret = 0; | int ret = 0;
| if (x >> 4) { x >>= 4; ret += 4; } | if (x >> 4) { x >>= 4; ret += 4; }
| return ret + ((0xFFFFAA50U >> (x << 1)) & 3) + 1; | return ret + ((0xFFFFAA50U >> (x << 1)) & 3) + 1;
| } | }
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)