[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Incremental search
- To: libevent-users@xxxxxxxxxxxxx
- Subject: Re: [Libevent-users] Incremental search
- From: Azat Khuzhin <a3at.mail@xxxxxxxxx>
- Date: Mon, 18 Dec 2017 22:17:40 +0300
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Mon, 18 Dec 2017 14:17:44 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=mWy9fAknHEDxhiFM75AySA1KSOHD9ZiAHv2uQAR9QGM=; b=BLfSrPAtB0kFXgzdMHbcIov3uw4oJRmz9hI63AExvNkYgnY0aMciPwsrpG0gflUXX/ TttXdqV38G7PtZ0wsLpqlpxBuqY4zGFYv4AJfwP2S/rLaqq6NHKxDzTQW4Otoe3bzJuO n1aBQzbFelbyn8bNiCZ5Cp5ZCazoxG+nVkunolwYiQcWJYXd7kOcyPt0T7iPD/xD89dW DFE2XfQgcvRn3iiH+xl8viEiY8Xj5W45mpkXe7s6gT0JuWlNIoNdEfJ5yaQItMcb9RTV ycUFZN0GByEnoH3MmWMdAKDfu8M0jv0ZShDIo9MpR2QITJ3S7kui5dH/vJIt1GP/sEHu YlRQ==
- In-reply-to: <20171218132320.GB3548@orkisz>
- References: <20171215110215.GA3189@orkisz> <CAG5DWojTW23LTRC12_=5a_S8exmArUA3KZeVAAR1p3jEpfY=hA@mail.gmail.com> <20171216215708.GA3141@orkisz> <20171218132320.GB3548@orkisz>
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
>> 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.