Fossil SCM
Remove unnecessary field from the auxiliary union <code>'bitfield64_t'</code> and amend the corresponding comments. Also add comment about FOOTNOTES_WITHOUT_URI macro.
Commit
cf1e96918edcd232723aaa9d1d1b34565828edcb9a3a70a8101edb94a48a8069
Parent
3a5b3d5e4956d36…
1 file changed
+14
-5
+14
-5
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -31,16 +31,16 @@ | ||
| 31 | 31 | |
| 32 | 32 | #endif /* INTERFACE */ |
| 33 | 33 | |
| 34 | 34 | /* |
| 35 | 35 | ** Markdown-internal helper for generating unique link reference IDs. |
| 36 | +** Fields provide typed interpretation of the underline memory buffer. | |
| 36 | 37 | */ |
| 37 | 38 | typedef union bitfield64_t bitfield64_t; |
| 38 | 39 | union bitfield64_t{ |
| 39 | - uint64_t u; | |
| 40 | - char c[8]; | |
| 41 | - unsigned char b[8]; | |
| 40 | + char c[8]; /* interpret as the array of signed characters */ | |
| 41 | + unsigned char b[8]; /* interpret as the array of unsigned characters */ | |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 | /* |
| 45 | 45 | ** An instance of the following structure is passed through the |
| 46 | 46 | ** "opaque" pointer. |
| @@ -58,22 +58,31 @@ | ||
| 58 | 58 | |
| 59 | 59 | /* INTER_BLOCK -- skip a line between block level elements */ |
| 60 | 60 | #define INTER_BLOCK(ob) \ |
| 61 | 61 | do { if( blob_size(ob)>0 ) blob_append_char(ob, '\n'); } while (0) |
| 62 | 62 | |
| 63 | +/* | |
| 64 | +** FOOTNOTES_WITHOUT_URI macro was introduced by [2c1f8f3592ef00e0] | |
| 65 | +** to enable flexibility in rendering of footnote-specific hyperlinks. | |
| 66 | +** It may be defined for a particular build in order to omit | |
| 67 | +** full REQUEST_URIs within footnote-specific (and page-local) hyperlinks. | |
| 68 | +** This *is* used for the builds that incorporate 'base-href-fix' branch | |
| 69 | +** (which in turn fixes footnotes on the preview tab of /wikiedit page). | |
| 70 | +*/ | |
| 63 | 71 | #ifndef FOOTNOTES_WITHOUT_URI |
| 64 | 72 | #define BLOB_APPEND_URI(dest,ctx) blob_appendb(dest,&((ctx)->reqURI)) |
| 65 | 73 | #else |
| 66 | 74 | #define BLOB_APPEND_URI(dest,ctx) |
| 67 | 75 | #endif |
| 68 | 76 | |
| 69 | -/* Converts an integer to a null-terminated base26 representation | |
| 77 | +/* Converts an integer to a textual base26 representation | |
| 78 | +** with proper null-termination. | |
| 70 | 79 | * Return empty string if that integer is negative. */ |
| 71 | 80 | static bitfield64_t to_base26(int i, int uppercase){ |
| 72 | 81 | bitfield64_t x; |
| 73 | 82 | int j; |
| 74 | - x.u = 0; | |
| 83 | + memset( &x, 0, sizeof(x) ); | |
| 75 | 84 | if( i >= 0 ){ |
| 76 | 85 | for(j=7; j >= 0; j--){ |
| 77 | 86 | x.b[j] = (unsigned char)(uppercase?'A':'a') + i%26; |
| 78 | 87 | if( (i /= 26) == 0 ) break; |
| 79 | 88 | } |
| 80 | 89 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -31,16 +31,16 @@ | |
| 31 | |
| 32 | #endif /* INTERFACE */ |
| 33 | |
| 34 | /* |
| 35 | ** Markdown-internal helper for generating unique link reference IDs. |
| 36 | */ |
| 37 | typedef union bitfield64_t bitfield64_t; |
| 38 | union bitfield64_t{ |
| 39 | uint64_t u; |
| 40 | char c[8]; |
| 41 | unsigned char b[8]; |
| 42 | }; |
| 43 | |
| 44 | /* |
| 45 | ** An instance of the following structure is passed through the |
| 46 | ** "opaque" pointer. |
| @@ -58,22 +58,31 @@ | |
| 58 | |
| 59 | /* INTER_BLOCK -- skip a line between block level elements */ |
| 60 | #define INTER_BLOCK(ob) \ |
| 61 | do { if( blob_size(ob)>0 ) blob_append_char(ob, '\n'); } while (0) |
| 62 | |
| 63 | #ifndef FOOTNOTES_WITHOUT_URI |
| 64 | #define BLOB_APPEND_URI(dest,ctx) blob_appendb(dest,&((ctx)->reqURI)) |
| 65 | #else |
| 66 | #define BLOB_APPEND_URI(dest,ctx) |
| 67 | #endif |
| 68 | |
| 69 | /* Converts an integer to a null-terminated base26 representation |
| 70 | * Return empty string if that integer is negative. */ |
| 71 | static bitfield64_t to_base26(int i, int uppercase){ |
| 72 | bitfield64_t x; |
| 73 | int j; |
| 74 | x.u = 0; |
| 75 | if( i >= 0 ){ |
| 76 | for(j=7; j >= 0; j--){ |
| 77 | x.b[j] = (unsigned char)(uppercase?'A':'a') + i%26; |
| 78 | if( (i /= 26) == 0 ) break; |
| 79 | } |
| 80 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -31,16 +31,16 @@ | |
| 31 | |
| 32 | #endif /* INTERFACE */ |
| 33 | |
| 34 | /* |
| 35 | ** Markdown-internal helper for generating unique link reference IDs. |
| 36 | ** Fields provide typed interpretation of the underline memory buffer. |
| 37 | */ |
| 38 | typedef union bitfield64_t bitfield64_t; |
| 39 | union bitfield64_t{ |
| 40 | char c[8]; /* interpret as the array of signed characters */ |
| 41 | unsigned char b[8]; /* interpret as the array of unsigned characters */ |
| 42 | }; |
| 43 | |
| 44 | /* |
| 45 | ** An instance of the following structure is passed through the |
| 46 | ** "opaque" pointer. |
| @@ -58,22 +58,31 @@ | |
| 58 | |
| 59 | /* INTER_BLOCK -- skip a line between block level elements */ |
| 60 | #define INTER_BLOCK(ob) \ |
| 61 | do { if( blob_size(ob)>0 ) blob_append_char(ob, '\n'); } while (0) |
| 62 | |
| 63 | /* |
| 64 | ** FOOTNOTES_WITHOUT_URI macro was introduced by [2c1f8f3592ef00e0] |
| 65 | ** to enable flexibility in rendering of footnote-specific hyperlinks. |
| 66 | ** It may be defined for a particular build in order to omit |
| 67 | ** full REQUEST_URIs within footnote-specific (and page-local) hyperlinks. |
| 68 | ** This *is* used for the builds that incorporate 'base-href-fix' branch |
| 69 | ** (which in turn fixes footnotes on the preview tab of /wikiedit page). |
| 70 | */ |
| 71 | #ifndef FOOTNOTES_WITHOUT_URI |
| 72 | #define BLOB_APPEND_URI(dest,ctx) blob_appendb(dest,&((ctx)->reqURI)) |
| 73 | #else |
| 74 | #define BLOB_APPEND_URI(dest,ctx) |
| 75 | #endif |
| 76 | |
| 77 | /* Converts an integer to a textual base26 representation |
| 78 | ** with proper null-termination. |
| 79 | * Return empty string if that integer is negative. */ |
| 80 | static bitfield64_t to_base26(int i, int uppercase){ |
| 81 | bitfield64_t x; |
| 82 | int j; |
| 83 | memset( &x, 0, sizeof(x) ); |
| 84 | if( i >= 0 ){ |
| 85 | for(j=7; j >= 0; j--){ |
| 86 | x.b[j] = (unsigned char)(uppercase?'A':'a') + i%26; |
| 87 | if( (i /= 26) == 0 ) break; |
| 88 | } |
| 89 |