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 
34  // Calloc will set these to 0
35  objectlink *ol = (objectlink *)calloc(1, sizeof(objectlink));
36  if (!ol)
38  return ol;
39 }
40 
52  // Calloc sets the values to 0 already
53  oblinkpt *obp = (oblinkpt *)calloc(1, sizeof(oblinkpt));
54 
55  if (!obp)
57  return obp;
58 }
59 
68  if (ol->next)
69  free_objectlink(ol->next);
70  free(ol);
71 }
72 
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
oblnk
Definition: object.h:446
OUT_OF_MEMORY
@ OUT_OF_MEMORY
Definition: define.h:48