Crossfire Server, Branch 1.12  R12190
links.c
Go to the documentation of this file.
00001 /*
00002  * static char *rcsid_friend_c =
00003  *   "$Id: links.c 11578 2009-02-23 22:02:27Z lalo $";
00004  */
00005 
00006 /*
00007     CrossFire, A Multiplayer game for X-windows
00008 
00009     Copyright (C) 1992 Frank Tore Johansen
00010 
00011     This program is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     This program is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU General Public License for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with this program; if not, write to the Free Software
00023     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024 
00025     The author can be reached via e-mail to frankj@ifi.uio.no.
00026 */
00027 
00033 #include <global.h>
00034 
00045 objectlink *get_objectlink(void) {
00046     objectlink *ol = (objectlink *)CALLOC(1, sizeof(objectlink));
00047     if (!ol)
00048         fatal(OUT_OF_MEMORY);
00049     ol->ob = NULL;
00050     ol->next = NULL;
00051     ol->id = 0;
00052     return ol;
00053 }
00054 
00065 oblinkpt *get_objectlinkpt(void) {
00066     oblinkpt *obp = (oblinkpt *)malloc(sizeof(oblinkpt));
00067 
00068     if (!obp)
00069         fatal(OUT_OF_MEMORY);
00070     obp->link = NULL;
00071     obp->next = NULL;
00072     obp->value = 0;
00073     return obp;
00074 }
00075 
00083 void free_objectlink(objectlink *ol) {
00084     if (ol->next)
00085         free_objectlink(ol->next);
00086     free(ol);
00087 }
00088 
00095 void free_objectlinkpt(oblinkpt *obp) {
00096     if (obp->next)
00097         free_objectlinkpt(obp->next);
00098     if (obp->link)
00099         free_objectlink(obp->link);
00100     free(obp);
00101 }