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

(find_previous_text_no): Optimize the case where the requested text is

larger than the highest created text.
parent 9d3ddcfc
/* /*
* $Id: text.c,v 0.28 1994/04/05 08:05:21 ceder Exp $ * $Id: text.c,v 0.29 1994/06/18 20:41:37 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994 Lysator Academic Computer Association. * Copyright (C) 1991, 1992, 1993, 1994 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* All atomic calls that deals with texts. * All atomic calls that deals with texts.
*/ */
static char *rcsid = "$Id: text.c,v 0.28 1994/04/05 08:05:21 ceder Exp $"; static char *rcsid = "$Id: text.c,v 0.29 1994/06/18 20:41:37 ceder Exp $";
#include "rcs.h" #include "rcs.h"
USE(rcsid); USE(rcsid);
...@@ -2079,7 +2079,7 @@ get_last_text(struct tm *wanted_time, ...@@ -2079,7 +2079,7 @@ get_last_text(struct tm *wanted_time,
/* /*
* Return next existing text-no. * Return next existing text-no, which ACTPERS is allowed to read.
*/ */
extern Success extern Success
...@@ -2105,7 +2105,7 @@ find_next_text_no (Text_no start, ...@@ -2105,7 +2105,7 @@ find_next_text_no (Text_no start,
/* /*
* Return next/previous existing text-no. * Return previous existing text-no, which ACTPERS is allowed to read.
*/ */
extern Success extern Success
...@@ -2113,6 +2113,10 @@ find_previous_text_no (Text_no start, ...@@ -2113,6 +2113,10 @@ find_previous_text_no (Text_no start,
Text_no *result) Text_no *result)
{ {
Text_stat *text_s; Text_stat *text_s;
Text_no next_tno;
if (start > (next_tno = query_next_text_num()))
start = next_tno;
while (start-- > 0) while (start-- > 0)
{ {
......
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