summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_dump.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-04-28 15:51:25 -0500
committerNicolai Hähnle <[email protected]>2016-04-29 11:39:28 -0500
commit318d305f6dd416295003d04b6c9092ae988f894a (patch)
treeb1d65e945c6fc66889b81f170e93f79426b020ea /src/gallium/auxiliary/tgsi/tgsi_dump.c
parente08eaa5b723a22301f117ac6120c3d9cd399855e (diff)
tgsi/dump: signal nospace when the last print exceeded the size
Previously, there was a bug where nospace wasn't signalled if it just so happened that the very last print exceeded the available space. Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_dump.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 94826446525..473fed11b61 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -753,7 +753,7 @@ str_dump_ctx_printf(struct dump_ctx *ctx, const char *format, ...)
{
struct str_dump_ctx *sctx = (struct str_dump_ctx *)ctx;
- if(sctx->left > 1) {
+ if (!sctx->nospace) {
int written;
va_list ap;
va_start(ap, format);
@@ -764,12 +764,14 @@ str_dump_ctx_printf(struct dump_ctx *ctx, const char *format, ...)
* vsnprintf:
*/
if (written > 0) {
- written = MIN2(sctx->left, written);
+ if (written >= sctx->left) {
+ sctx->nospace = true;
+ written = sctx->left;
+ }
sctx->ptr += written;
sctx->left -= written;
}
- } else
- sctx->nospace = true;
+ }
}
bool