changeset 279:15e2ee6c7bfc

Add th_printf_ctx.ipos and use it for return values. It's a hack. :S
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 22 Feb 2016 11:49:05 +0200
parents a6088507317b
children 454f0d37d94b
files th_string.c th_string.h
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/th_string.c	Mon Feb 22 11:48:23 2016 +0200
+++ b/th_string.c	Mon Feb 22 11:49:05 2016 +0200
@@ -362,7 +362,7 @@
     }
 
 out:
-    return ret == EOF ? ret : ctx->pos;
+    return ret == EOF ? ret : ctx->ipos;
 }
 
 
@@ -372,6 +372,7 @@
     if (ctx->pos < ctx->size)
         ctx->buf[ctx->pos] = ch;
     ctx->pos++;
+    ctx->ipos++;
     return ch;
 }
 
@@ -379,6 +380,7 @@
 static int th_stdio_vputch(th_printf_ctx *ctx, const char ch)
 {
     ctx->pos++;
+    ctx->ipos++;
     return fputc(ch, (FILE *) ctx->data);
 }
 #endif
--- a/th_string.h	Mon Feb 22 11:48:23 2016 +0200
+++ b/th_string.h	Mon Feb 22 11:49:05 2016 +0200
@@ -52,6 +52,7 @@
 {
     char *buf;
     size_t size, pos;
+    int ipos;
     void *data;
 } th_printf_ctx;