Local Constants
Sometimes you want to symbolically define a constant for a limited scope. Buryint the constant in some header file is not terribly useful or easy to access when the constant isn't used anywhere else. For example in this code, the constants '8' and '16'
(see the /* !!! */) could be locally defined to avoid an error-prone maintenance situation...
...
else
{ if(acx_write_mem(g_myAgentID,
blank_bytes,
ddr_offset_now,
16, /* !!! */
ACX_TRANSFER_KERNEL_SPACE_MEMCPY) < 1)
{
return -EFAULT;
}
ddr_offset_now += 16; /* !!! */
}
/* Only copy the initial vector for CBC modes
*/
if (theHeader->isCBC)
{
if(acx_write_mem(g_myAgentID,
theJob.initialVector,
ddr_offset_now,
8, /* !!! */
ACX_TRANSFER_KERNEL_SPACE_MEMCPY) < 1)
{
return -EFAULT;
}
}
else
{ if(acx_write_mem(g_myAgentID,
blank_bytes,
ddr_offset_now,
8, /* !!! */
ACX_TRANSFER_KERNEL_SPACE_MEMCPY) < 1)
{
return -EFAULT;
}
}
ddr_offset_now += 8; /* !!! */
--
MattWalsh - 05 Apr 2002