diff options
Diffstat (limited to 'iconv')
-rw-r--r-- | iconv/gconv.h | 9 | ||||
-rw-r--r-- | iconv/gconv_open.c | 6 | ||||
-rw-r--r-- | iconv/skeleton.c | 5 |
3 files changed, 19 insertions, 1 deletions
diff --git a/iconv/gconv.h b/iconv/gconv.h index b359c92c62..1e19c9650a 100644 --- a/iconv/gconv.h +++ b/iconv/gconv.h @@ -100,8 +100,17 @@ struct gconv_step_data char *outbuf; /* Output buffer for this step. */ char *outbufend; /* Address of first byte after the output buffer. */ + /* Is this the last module in the chain. */ int is_last; + /* Counter for number of invocations of the module function for this + desriptor. */ + int invocation_counter; + + /* Flag whether this is an internal use of the module (in the mb*towc* + and wc*tomb* functions) or regular with iconv(3). */ + int internal_use; + mbstate_t *statep; mbstate_t __state; /* This element should not be used directly by any module; always use STATEP! */ diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c index d7e0191cca..fb5f88b9a3 100644 --- a/iconv/gconv_open.c +++ b/iconv/gconv_open.c @@ -65,6 +65,12 @@ __gconv_open (const char *toset, const char *fromset, gconv_t *handle) buffer. */ data[cnt].is_last = cnt == nsteps - 1; + /* Reset the counter. */ + data[cnt].invocation_counter = 0; + + /* It's a regular use. */ + data[cnt].internal_use = 0; + /* We use the `mbstate_t' member in DATA. */ data[cnt].statep = &data[cnt].__state; diff --git a/iconv/skeleton.c b/iconv/skeleton.c index f0445f1408..418247f769 100644 --- a/iconv/skeleton.c +++ b/iconv/skeleton.c @@ -90,7 +90,7 @@ static int from_object; static int to_object; # ifndef FROM_DIRECTION -# define FROM_DIRECTION step->data == &from_object +# define FROM_DIRECTION (step->data == &from_object) # endif #else # ifndef FROM_DIRECTION @@ -346,6 +346,9 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data, #ifdef END_LOOP END_LOOP #endif + + /* We finished one use of this step. */ + ++data->invocation_counter; } return status; |