return (htx->size - htx_used_space(htx));
}
-/* Returns the maximum space usable for data in <htx>. This is in fact the
- * maximum sice for a uniq block to fill the HTX message. */
-static inline uint32_t htx_max_data_space(const struct htx *htx)
-{
- if (!htx->size)
- return 0;
- return (htx->size - sizeof(htx->blocks[0]));
-}
-
/* Returns the maximum size available to store some data in <htx> if a new block
* is reserved.
*/
* cause an integer underflow in the comparison since both are unsigned
* while maxrewrite is signed.
* The code below has been verified for being a valid check for this :
- * - if (o + to_forward) overflow => return max_data_space [ large enough ]
- * - if o + to_forward >= maxrw => return max_data_space [ large enough ]
- * - otherwise return max_data_space - (maxrw - (o + to_forward))
+ * - if (o + to_forward) overflow => return htx->size [ large enough ]
+ * - if o + to_forward >= maxrw => return htx->size [ large enough ]
+ * - otherwise return htx->size - (maxrw - (o + to_forward))
*/
transit = co_data(chn) + chn->to_forward;
reserve -= transit;
if (transit < chn->to_forward || // addition overflow
transit >= (unsigned)global.tune.maxrewrite) // enough transit data
- return htx_max_data_space(htx);
+ return htx->size;
end:
- return (htx_max_data_space(htx) - reserve);
+ return (htx->size - reserve);
}
/* HTX version of channel_full(). Instead of checking if INPUT data exceeds