ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/links.C
(Generate patch)

Comparing deliantra/server/common/links.C (file contents):
Revision 1.1 by elmex, Sun Aug 13 17:16:00 2006 UTC vs.
Revision 1.4 by root, Sun Oct 15 02:16:34 2006 UTC

1/*
2 * static char *rcsid_friend_c =
3 * "$Id: links.C,v 1.1 2006/08/13 17:16:00 elmex Exp $";
4 */
5
6/* 1/*
7 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
8 3
9 Copyright (C) 1992 Frank Tore Johansen 4 Copyright (C) 1992 Frank Tore Johansen
10 5
30/* 25/*
31 * Allocates a new objectlink structure, initialises it, and returns 26 * Allocates a new objectlink structure, initialises it, and returns
32 * a pointer to it. 27 * a pointer to it.
33 */ 28 */
34 29
35objectlink *get_objectlink(void) { 30objectlink *
36 objectlink *ol=(objectlink *)CALLOC(1,sizeof(objectlink)); 31get_objectlink (void)
37 ol->ob=NULL; 32{
38 ol->next=NULL; 33 objectlink *ol = new objectlink;
34
39 ol->id = 0; 35 ol->ob = 0;
36 ol->next = 0;
40 return ol; 37 return ol;
41} 38}
42 39
43/* 40/*
44 * Allocates a new oblinkpt structure, initialises it, and returns 41 * Allocates a new oblinkpt structure, initialises it, and returns
45 * a pointer to it. 42 * a pointer to it.
46 */ 43 */
47 44
45oblinkpt *
48oblinkpt *get_objectlinkpt(void) { 46get_objectlinkpt (void)
49 oblinkpt *obp = (oblinkpt *) malloc(sizeof(oblinkpt)); 47{
48 oblinkpt *obp = new oblinkpt;
49
50 obp->link = NULL; 50 obp->link = 0;
51 obp->next = NULL; 51 obp->next = 0;
52 obp->value = 0; 52 obp->value = 0;
53 return obp; 53 return obp;
54} 54}
55 55
56/* 56/*
57 * Recursively frees all objectlinks 57 * Recursively frees all objectlinks
58 */ 58 */
59 59
60void
60void free_objectlink(objectlink *ol) { 61free_objectlink (objectlink * ol)
62{
61 if (ol->next) 63 if (ol->next)
62 free_objectlink(ol->next); 64 free_objectlink (ol->next);
63 free(ol); 65
66 delete ol;
64} 67}
65 68
66/* 69/*
67 * Recursively frees all linked list of objectlink pointers 70 * Recursively frees all linked list of objectlink pointers
68 */ 71 */
69 72
73void
70void free_objectlinkpt(oblinkpt *obp) { 74free_objectlinkpt (oblinkpt *obp)
75{
71 if (obp->next) 76 if (obp->next)
72 free_objectlinkpt(obp->next); 77 free_objectlinkpt (obp->next);
78
73 if (obp->link) 79 if (obp->link)
74 free_objectlink(obp->link); 80 free_objectlink (obp->link);
75 free(obp); 81
82 delete obp;
76} 83}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines