Commit b825ea10 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(remove_loc_no): srealloc() or sfree() the read_ranges if we remove a range.

parent 3f423a3b
/* /*
* $Id: membership.c,v 0.80 2002/11/15 17:15:12 ceder Exp $ * $Id: membership.c,v 0.81 2002/11/26 11:05:43 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association. * Copyright (C) 1991-2002 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -680,6 +680,16 @@ remove_loc_no(Local_text_no text, ...@@ -680,6 +680,16 @@ remove_loc_no(Local_text_no text,
for (move = lo; move < (end-1); move++) for (move = lo; move < (end-1); move++)
*move = *(move+1); *move = *(move+1);
m->no_of_read_ranges--; m->no_of_read_ranges--;
if (m->no_of_read_ranges == 0)
{
sfree(m->read_ranges);
m->read_ranges = NULL;
}
else
m->read_ranges = srealloc(
m->read_ranges,
m->no_of_read_ranges * sizeof(m->read_ranges[0]));
return; return;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment