Crossfire Server, Trunk
links.cpp
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
objectlink::next
objectlink * next
Definition:
object.h:462
oblinkpt::next
oblinkpt * next
Definition:
object.h:472
oblinkpt
Definition:
object.h:469
objectlink
Definition:
object.h:460
oblinkpt::link
objectlink * link
Definition:
object.h:470
fatal
void fatal(enum fatal_error err)
Definition:
utils.cpp:590
free_objectlinkpt
void free_objectlinkpt(oblinkpt *obp)
Definition:
links.cpp:79
free_objectlink
void free_objectlink(objectlink *ol)
Definition:
links.cpp:67
OUT_OF_MEMORY
@ OUT_OF_MEMORY
Definition:
define.h:48
get_objectlink
objectlink * get_objectlink(void)
Definition:
links.cpp:33
get_objectlinkpt
oblinkpt * get_objectlinkpt(void)
Definition:
links.cpp:51
crossfire-crossfire-server
common
links.cpp
Generated by
1.8.17