Commit 8fd0468c authored by Daniel Kamil Kozar's avatar Daniel Kamil Kozar Committed by Jean-Paul Saman

try to separate actual checks from looping in BOZO_array macros

Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent 8423b619
...@@ -134,7 +134,8 @@ static int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix" ...@@ -134,7 +134,8 @@ static int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix"
<xsl:template match="array" mode="check"> <xsl:template match="array" mode="check">
/* check <xsl:value-of select="@name" /> */<xsl:apply-templates select=".." mode="init" /> /* check <xsl:value-of select="@name" /> */<xsl:apply-templates select=".." mode="init" />
BOZO_begin_array(<xsl:value-of select="@name" />, <xsl:value-of select="@len_name" />, <xsl:value-of select="@min_size" />) BOZO_begin_array(<xsl:value-of select="@name" />)
BOZO_loop_array_begin(<xsl:value-of select="@name" />, <xsl:value-of select="@len_name" />, <xsl:value-of select="@min_size" />)
BOZO_DOJOB(<xsl:value-of select="../@fname" />); BOZO_DOJOB(<xsl:value-of select="../@fname" />);
BOZO_check_array_begin(<xsl:value-of select="@name" />, <xsl:value-of select="@len_name" />) BOZO_check_array_begin(<xsl:value-of select="@name" />, <xsl:value-of select="@len_name" />)
<xsl:choose> <xsl:choose>
...@@ -153,7 +154,7 @@ static int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix" ...@@ -153,7 +154,7 @@ static int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix"
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_array(<xsl:value-of select="@name" /><xsl:text>, </xsl:text> BOZO_loop_array_end(<xsl:value-of select="@name" /><xsl:text>, </xsl:text>
<xsl:choose> <xsl:choose>
<xsl:when test="@max_size"> <xsl:when test="@max_size">
<xsl:value-of select="@max_size"/> <xsl:value-of select="@max_size"/>
...@@ -165,7 +166,7 @@ static int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix" ...@@ -165,7 +166,7 @@ static int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix"
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:text>)</xsl:text> <xsl:text>)</xsl:text>
BOZO_end_array
</xsl:template> </xsl:template>
<xsl:template match="insert" mode="check"> <xsl:template match="insert" mode="check">
......
This diff is collapsed.
...@@ -135,19 +135,23 @@ static void BOZO_fill_array(void *a, size_t len) ...@@ -135,19 +135,23 @@ static void BOZO_fill_array(void *a, size_t len)
for(size_t i = 0 ; i < len ; ++i) b[i] = rand(); for(size_t i = 0 ; i < len ; ++i) b[i] = rand();
} }
#define BOZO_begin_array(name, len_name, min_size) \ #define BOZO_begin_array(name) \
if(!i_err) \ if(!i_err) \
{ \ { \
fprintf(stdout, " \"%s\" array check\n", #name); \ fprintf(stdout, " \"%s\" array check\n", #name);
#define BOZO_loop_array_begin(name, len_name, min_size) \
i_loop_count = min_size; \ i_loop_count = min_size; \
do \ do \
{ \ { \
BOZO_fill_array(s_decoded.name, sizeof(s_decoded.name)); \ BOZO_fill_array(s_decoded.name, sizeof(s_decoded.name)); \
s_decoded.len_name = i_loop_count; s_decoded.len_name = i_loop_count;
#define BOZO_end_array(name, max_len) \ #define BOZO_loop_array_end(name, max_len) \
} while(!i_err && i_loop_count < max_len); \ } while(!i_err && i_loop_count < max_len); \
fprintf(stdout, "\r iteration count: %22"PRI64d, i_loop_count); \ fprintf(stdout, "\r iteration count: %22"PRI64d, i_loop_count);
#define BOZO_end_array \
if(i_err) \ if(i_err) \
fprintf(stdout, " FAILED !!!\n"); \ fprintf(stdout, " FAILED !!!\n"); \
else \ else \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment