Crossfire Server, Trunk
links.c
Go to the documentation of this file.
1
/*
2
* Crossfire -- cooperative multi-player graphical RPG and adventure game
3
*
4
* Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5
* Copyright (c) 1992 Frank Tore Johansen
6
*
7
* Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8
* welcome to redistribute it under certain conditions. For details, please
9
* see COPYING and LICENSE.
10
*
11
* The authors can be reached via e-mail at <crossfire@metalforge.org>.
12
*/
13
19
#include "
global.h
"
20
21
#include <stdlib.h>
22
33
objectlink
*
get_objectlink
(
void
) {
34
// Calloc will set these to 0
35
objectlink
*ol = (
objectlink
*)calloc(1,
sizeof
(
objectlink
));
36
if
(!ol)
37
fatal
(
OUT_OF_MEMORY
);
38
return
ol;
39
}
40
51
oblinkpt
*
get_objectlinkpt
(
void
) {
52
// Calloc sets the values to 0 already
53
oblinkpt
*obp = (
oblinkpt
*)calloc(1,
sizeof
(
oblinkpt
));
54
55
if
(!obp)
56
fatal
(
OUT_OF_MEMORY
);
57
return
obp;
58
}
59
67
void
free_objectlink
(
objectlink
*ol) {
68
if
(ol->
next
)
69
free_objectlink
(ol->
next
);
70
free(ol);
71
}
72
79
void
free_objectlinkpt
(
oblinkpt
*obp) {
80
if
(obp->
next
)
81
free_objectlinkpt
(obp->
next
);
82
if
(obp->
link
)
83
free_objectlink
(obp->
link
);
84
free(obp);
85
}
global.h
oblinkpt::link
struct oblnk * link
Definition:
object.h:456
oblinkpt
Definition:
object.h:455
oblnk::next
struct oblnk * next
Definition:
object.h:448
oblinkpt::next
struct oblinkpt * next
Definition:
object.h:458
fatal
void fatal(enum fatal_error err)
Definition:
utils.c:580
get_objectlink
objectlink * get_objectlink(void)
Definition:
links.c:33
free_objectlinkpt
void free_objectlinkpt(oblinkpt *obp)
Definition:
links.c:79
get_objectlinkpt
oblinkpt * get_objectlinkpt(void)
Definition:
links.c:51
oblnk
Definition:
object.h:446
OUT_OF_MEMORY
@ OUT_OF_MEMORY
Definition:
define.h:48
free_objectlink
void free_objectlink(objectlink *ol)
Definition:
links.c:67
crossfire-crossfire-server
common
links.c
Generated by
1.8.17