Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
d967541f
Commit
d967541f
authored
Nov 04, 2001
by
Per Cederqvist
Browse files
(remove_misc_item): New function.
(do_sub_comment): Use it to simplify code. (do_sub_footnote): Ditto. (Bug 186).
parent
856f9e27
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/server/text.c
View file @
d967541f
/*
* $Id: text.c,v 0.8
7
2001/11/04
18:08:08
ceder Exp $
* $Id: text.c,v 0.8
8
2001/11/04
20:34:42
ceder Exp $
* Copyright (C) 1991-2001 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
...
...
@@ -34,7 +34,7 @@
#endif
static
const
char
*
rcsid
=
"$Id: text.c,v 0.8
7
2001/11/04
18:08:08
ceder Exp $"
;
rcsid
=
"$Id: text.c,v 0.8
8
2001/11/04
20:34:42
ceder Exp $"
;
#include
"rcs.h"
USE
(
rcsid
);
...
...
@@ -654,6 +654,34 @@ do_sub_recpt(Text_no text_no,
return
FAILURE
;
}
/* OTHER is a INFO_TYPE to text number TEXT (whose text status is
TEXT_S). This function removes that misc-info from TEXT_S. */
static
void
remove_misc_item
(
Text_no
text
,
Text_stat
*
text_s
,
Info_type
info_type
,
Text_no
other
)
{
int
i
;
assert
(
info_type
==
comm_to
||
info_type
==
comm_in
||
info_type
==
footn_to
||
info_type
==
footn_in
);
for
(
i
=
0
;
i
<
text_s
->
no_of_misc
;
i
++
)
{
if
(
text_s
->
misc_items
[
i
].
type
==
info_type
&&
text_s
->
misc_items
[
i
].
datum
.
text_link
==
other
)
{
do_delete_misc
(
&
text_s
->
no_of_misc
,
text_s
->
misc_items
,
i
);
mark_text_as_changed
(
text
);
return
;
}
}
restart_kom
(
"remove_misc_item() failed.
\n
"
);
}
/*
* Delete the link between comment and comment_to.
*/
...
...
@@ -663,60 +691,14 @@ do_sub_comment(Text_no comment, /* The comment. */
Text_no
comment_to
,
/* The commented. */
Text_stat
*
parent_s
)
{
int
i
;
Bool
ready
;
if
(
text_s
==
NULL
)
VOID_GET_T_STAT
(
text_s
,
comment
);
if
(
parent_s
==
NULL
)
VOID_GET_T_STAT
(
parent_s
,
comment_to
);
for
(
ready
=
FALSE
,
i
=
0
;
!
ready
&&
i
<
text_s
->
no_of_misc
;
i
++
)
{
switch
(
text_s
->
misc_items
[
i
].
type
)
{
case
comm_to
:
if
(
text_s
->
misc_items
[
i
].
datum
.
text_link
==
comment_to
)
{
do_delete_misc
(
&
text_s
->
no_of_misc
,
text_s
->
misc_items
,
i
);
mark_text_as_changed
(
comment
);
ready
=
TRUE
;
}
break
;
default:
break
;
}
}
if
(
!
ready
)
restart_kom
(
"do_sub_comment(): part 1 failed.
\n
"
);
for
(
ready
=
FALSE
,
i
=
0
;
!
ready
&&
i
<
parent_s
->
no_of_misc
;
i
++
)
{
switch
(
parent_s
->
misc_items
[
i
].
type
)
{
case
comm_in
:
if
(
parent_s
->
misc_items
[
i
].
datum
.
text_link
==
comment
)
{
do_delete_misc
(
&
parent_s
->
no_of_misc
,
parent_s
->
misc_items
,
i
);
mark_text_as_changed
(
comment_to
);
ready
=
TRUE
;
}
break
;
default:
break
;
}
}
if
(
!
ready
)
restart_kom
(
"do_sub_comment(): part 2 failed.
\n
"
);
return
;
remove_misc_item
(
comment
,
text_s
,
comm_to
,
comment_to
);
remove_misc_item
(
comment_to
,
parent_s
,
comm_in
,
comment
);
}
...
...
@@ -724,64 +706,19 @@ do_sub_comment(Text_no comment, /* The comment. */
* Delete the link between footnote and footnote_to.
*/
static
void
do_sub_footnote
(
Text_no
footnote
,
do_sub_footnote
(
Text_no
footnote
,
Text_stat
*
text_s
,
Text_no
footnote_to
,
Text_stat
*
parent_s
)
{
int
i
;
Bool
ready
;
if
(
text_s
==
NULL
)
VOID_GET_T_STAT
(
text_s
,
footnote
);
if
(
parent_s
==
NULL
)
VOID_GET_T_STAT
(
parent_s
,
footnote_to
);
for
(
ready
=
FALSE
,
i
=
0
;
!
ready
&&
i
<
text_s
->
no_of_misc
;
i
++
)
{
switch
(
text_s
->
misc_items
[
i
].
type
)
{
case
footn_to
:
if
(
text_s
->
misc_items
[
i
].
datum
.
text_link
==
footnote_to
)
{
do_delete_misc
(
&
text_s
->
no_of_misc
,
text_s
->
misc_items
,
i
);
mark_text_as_changed
(
footnote
);
ready
=
TRUE
;
}
break
;
default:
break
;
}
}
if
(
!
ready
)
restart_kom
(
"do_sub_footnote(): part 1 failed.
\n
"
);
for
(
ready
=
FALSE
,
i
=
0
;
!
ready
&&
i
<
parent_s
->
no_of_misc
;
i
++
)
{
switch
(
parent_s
->
misc_items
[
i
].
type
)
{
case
footn_in
:
if
(
parent_s
->
misc_items
[
i
].
datum
.
text_link
==
footnote
)
{
do_delete_misc
(
&
parent_s
->
no_of_misc
,
parent_s
->
misc_items
,
i
);
mark_text_as_changed
(
footnote_to
);
ready
=
TRUE
;
}
break
;
default:
break
;
}
}
if
(
!
ready
)
restart_kom
(
"do_sub_footnote(): part 2 failed.
\n
"
);
return
;
remove_misc_item
(
footnote
,
text_s
,
footn_to
,
footnote_to
);
remove_misc_item
(
footnote_to
,
parent_s
,
footn_in
,
footnote
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment