register_signal.c

Go to the documentation of this file.
00001 /*
00002  EasyDbus: DBUS Binding Library.
00003  Copyright (C) 2007  Daniele Rondina aka ge@@ru, geaaru@gmail.com 
00004 
00005  This program is free software; you can redistribute it and/or
00006  modify it under the terms of the GNU General Public License
00007  as published by the Free Software Foundation; either version 2
00008  of the License, or (at your option) any later version.
00009 
00010  This program is distributed in the hope that it will be useful,
00011  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  GNU General Public License for more details.
00014 
00015  You should have received a copy of the GNU General Public License
00016  along with this program; if not, write to the Free Software
00017  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 
00019   Filename:  register_signal.c
00020  
00021   Description:  
00022  
00023   Version:  1.0
00024   Created:  06/27/07 22:56:59 CEST
00025   Revision:  
00026     0 - created
00027     1 - 10/08/07 - use opaque structs.
00028     2 - added doxygen documentation and renamed 
00029         EasyDbus_signal_core object to 
00030         EasyDbus_obj_signal. (ge@@ru) 11/06/07
00031  
00032   Author:   Daniele Rondina aka Ge@@ru (geaaru@gmail.com) 
00033   License:  GPL 2.0
00034 */
00035 
00041 #include <string.h>
00042 #include <stdlib.h>
00043 // easydbus includes
00044 #include "easydbus-core.h"
00045 #include "introspect_internal.h"
00046 #include "debug.h"
00047 
00057 EasyDbus_obj_signal *
00058 easydbus_obj_signal_create (char *signal)
00059 {
00060    int string_length;
00061    struct EasyDbus_obj_signal *signal_skeleton = NULL;
00062 
00063    if (!signal)
00064       return NULL;
00065 
00066    signal_skeleton = (struct EasyDbus_obj_signal *)
00067       malloc (sizeof (struct EasyDbus_obj_signal));
00068 
00069    if (!signal_skeleton)
00070       return NULL;
00071 
00072    signal_skeleton->output_info = NULL;
00073    signal_skeleton->next = NULL;
00074 
00075    string_length = strlen (signal) + 1;
00076    signal_skeleton->name = (char *) malloc (string_length);
00077 
00078    if (!signal_skeleton->name)
00079       goto out_of_memory;
00080 
00081    EASYDBUS_MEMCOPY (signal_skeleton, signal,
00082                      string_length);
00083 
00084    EasyDbusDebug ("Create signal_core %s", signal_skeleton->name);
00085 
00086    return signal_skeleton;
00087 
00088  out_of_memory:
00089    free (signal_skeleton);
00090    return NULL;
00091 }
00092 
00093 
00099 void 
00100 easydbus_obj_signal_free (EasyDbus_obj_signal * signal) 
00101 {
00102    struct easydbus_introspect_arg_info *el = NULL;
00103 
00104    if (!signal)
00105       return;
00106 
00107    el = signal->output_info;
00108    while (el) {
00109       signal->output_info = el->next;
00110       easydbus_free_introspect_info_arg (el);
00111       el = signal->output_info;
00112       EasyDbusDebug ("Free of output arg element");
00113    }
00114 
00115    free (signal->name);
00116 
00117    free (signal);
00118 }
00119 
00120 // vim: ts=3 shiftwidth=3 expandtab

Generated on Thu Apr 10 10:00:18 2008 for EasyDbus-0.2 by  doxygen 1.5.4