<xsl:variable name="h" select="$mode = 'header'" />
<xsl:variable name="c" select="$mode = 'source'" />
+
+ <xsl:variable name="need-string-h" select="//request/pad[@bytes != 1]" />
<!-- String used to indent lines of code. -->
<xsl:variable name="indent-string" select="' '" />
<l><xsl:value-of select="@ref" /> xcb_out;</l>
<l />
- <xsl:apply-templates select="$struct//*[(self::field or self::exprfield)
+ <xsl:apply-templates select="$struct//*[(self::field or self::exprfield or self::pad)
and not(boolean(@no-assign))]"
mode="assign" />
</l>
</xsl:template>
+ <xsl:template match="pad" mode="assign">
+ <xsl:variable name="padnum"><xsl:number /></xsl:variable>
+ <l><xsl:choose>
+ <xsl:when test="@bytes = 1">xcb_out.pad<xsl:value-of select="$padnum - 1" /> = 0;</xsl:when>
+ <xsl:otherwise>memset(xcb_out.pad<xsl:value-of select="$padnum - 1" />, 0, <xsl:value-of select="@bytes" />);</xsl:otherwise>
+ </xsl:choose></l>
+ </xsl:template>
+
<xsl:template match="iterator" mode="pass2">
<struct name="{@ref}_iterator_t">
<field type="{@ref}_t *" name="data" />
</xsl:choose>
</xsl:if>
-<xsl:if test="$c"><xsl:text>
+<xsl:if test="$c">
+<xsl:if test="$need-string-h">
+#include <string.h></xsl:if>
+<xsl:text>
#include <assert.h>
#include "xcbext.h"
#include "</xsl:text><xsl:value-of select="$header" /><xsl:text>.h"