Lines Matching defs:ctx
77 hex_decode_init(hex_decode_ctx_t *ctx, int length, isc_buffer_t *target)
79 ctx->digits = 0;
80 ctx->length = length;
81 ctx->target = target;
85 hex_decode_char(hex_decode_ctx_t *ctx, int c) {
90 ctx->val[ctx->digits++] = (int)(s - hex);
91 if (ctx->digits == 2) {
94 num = (ctx->val[0] << 4) + (ctx->val[1]);
95 RETERR(isc_mem_tobuffer(ctx->target, &num, 1));
96 if (ctx->length >= 0) {
97 if (ctx->length == 0)
100 ctx->length -= 1;
102 ctx->digits = 0;
108 hex_decode_finish(hex_decode_ctx_t *ctx) {
109 if (ctx->length > 0)
111 if (ctx->digits != 0)
118 hex_decode_ctx_t ctx;
120 hex_decode_init(&ctx, -1, target);
127 RETERR(hex_decode_char(&ctx, c));
129 RETERR(hex_decode_finish(&ctx));