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

(insert_loc_no): Handle the case where adjoining ranges exists

	properly instead of producing overlapping ranges.
parent f58f660a
/* /*
* $Id: membership.c,v 0.95 2003/08/23 16:38:15 ceder Exp $ * $Id: membership.c,v 0.96 2003/08/28 23:13:06 ceder Exp $
* Copyright (C) 1991-2003 Lysator Academic Computer Association. * Copyright (C) 1991-2003 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -609,12 +609,18 @@ insert_loc_no(Local_text_no text, ...@@ -609,12 +609,18 @@ insert_loc_no(Local_text_no text,
if (text == lo->first_read - 1) if (text == lo->first_read - 1)
{ {
if (lo > begin && text == (lo-1)->last_read)
return FAILURE;
lo->first_read = text; lo->first_read = text;
return OK; return OK;
} }
if (text == lo->last_read + 1) if (text == lo->last_read + 1)
{ {
if (lo < end && (lo+1) < end && text == (lo+1)->first_read)
return FAILURE;
lo->last_read = text; lo->last_read = text;
return OK; return OK;
} }
......
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