[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Incremental search



>> Actually I do. Currently it looks like that:
>> #v+
>>     } else {
>>         // a hit
>>
>>         ctx->incr_ptr.pos = -1;
>>
>>         cptr = malloc (tmp_ptr.pos + 1);
>>         evbuffer_remove (ctx->evbuff_in, cptr, tmp_ptr.pos);
>>         evbuffer_drain (ctx->evbuff_in, 1);
>>         cptr[tmp_ptr.pos] = '\0';
>>         printf("data: %s\n", cptr);
>>         free (cptr);
>>     }
>> #v-
>>
>> In my previous email I left only the line marking the evbuffer_ptr as
>> invalid to force recalculation in the next iteration:
>>
>>     ctx->incr_ptr.pos != -1 ? &ctx->incr_ptr : NULL
>
> Just to be sure -- is the above solution correct or did I miss something
> (about evbuffer_ptr invalidation for example)?

Well, it looks correct to me, but I would definitely test this well
before using it of course.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.