예제 #1
0
void buff_shift(buff_t *self, uint start, uint length)
{
    /* Shift buffer contents to delete the specified segment. */
    /* Implemented for deleting html comments.		      */

    BOGO_ASSERT(start + length <= self->t.leng,
		"Invalid buff_shift() parameters.");

    memmove(self->t.u.text + start, self->t.u.text + start + length, self->t.leng - length);
    self->t.leng -= length;
    Z(self->t.u.text[self->t.leng]);		/* for easier debugging - removable */
    return;
}
예제 #2
0
void buff_shift(buff_t *self, byte *start, uint length)
{
    /* Shift buffer contents to delete the specified segment. */
    /* Implemented for deleting html comments.		      */
    byte *buff_end = self->t.text+self->t.leng;
    byte *move_end = start + length;

    BOGO_ASSERT((self->t.text <= start) && (move_end <= buff_end),
	   "Invalid buff_shift() parameters.");

    memmove(start, start+length, buff_end - move_end);
    self->t.leng -= length;
    Z(self->t.text[self->t.leng]);		/* for easier debugging - removable */
    return;
}