diff options
author | Darius Davis <darius-wireshark@free-range.com.au> | 2024-04-05 20:40:37 +1000 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2024-04-05 21:39:39 +0000 |
commit | a3e7a7fb297e202a0824a014e905d259013bb08e (patch) | |
tree | da56e29d79c999563901216e9eb56f079dfcd1c4 /fix/hfDecl.xsl | |
parent | d0b143bbecf422db5b6f51b549726786e85a3540 (diff) |
fix: "const"-ify most of fix_fields.
Only the hf_id field in fix_fields is ever modified; This change separates out
hf_id and makes the rest of that structure "const", moving about 26 kBytes of
data from a read-write data section to a read-only data section, moving another
6 kBytes of read-write data (formerly field hf_id) to .bss -- and reclaiming
another 6 kBytes of read-write data space which was being entirely wasted due
to field packing in the struct in 64-bit builds.
Diffstat (limited to 'fix/hfDecl.xsl')
-rw-r--r-- | fix/hfDecl.xsl | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fix/hfDecl.xsl b/fix/hfDecl.xsl index b44d32e85c..ae50d80bcd 100644 --- a/fix/hfDecl.xsl +++ b/fix/hfDecl.xsl @@ -6,14 +6,8 @@ <xsl:template match="text()"/> - <xsl:template match="/"> -static fix_field fix_fields[] = { -<xsl:apply-templates/> - }; -</xsl:template> - - <xsl:template match="fields"> +static const fix_field fix_fields[] = { <xsl:for-each select="field"> <xsl:sort select="@number" data-type="number"/> <xsl:choose> @@ -25,10 +19,15 @@ static fix_field fix_fields[] = { <xsl:otherwise>2</xsl:otherwise> </xsl:choose> </xsl:variable> - { <xsl:value-of select="@number"/>, -1, <xsl:copy-of select="$val_type" />, <xsl:value-of select="@name"/>_val },</xsl:when> + { <xsl:value-of select="@number"/>, <xsl:copy-of select="$val_type" />, <xsl:value-of select="@name"/>_val },</xsl:when> <xsl:otherwise> - { <xsl:value-of select="@number"/>, -1, 0, NULL }, /* <xsl:value-of select="@name"/> */</xsl:otherwise> + { <xsl:value-of select="@number"/>, 0, NULL }, /* <xsl:value-of select="@name"/> */</xsl:otherwise> </xsl:choose> </xsl:for-each> + }; + +<xsl:text>static int fix_hf[</xsl:text> +<xsl:value-of select="count( field )"/> +<xsl:text>];</xsl:text> </xsl:template> </xsl:stylesheet> |