1.1 --- a/gmyth/src/gmyth_common.c Fri Jan 26 19:08:17 2007 +0000
1.2 +++ b/gmyth/src/gmyth_common.c Mon Mar 19 17:11:23 2007 +0000
1.3 @@ -36,26 +36,24 @@
1.4 static void free_channel_data(gpointer data, gpointer user_data);
1.5 static void free_program_data(gpointer data, gpointer user_data);
1.6
1.7 -/** Frees the memory allocated to the GMythChannelInfo objects inside list.
1.8 +/**
1.9 + * Frees the memory allocated to the GMythChannelInfo objects inside list.
1.10 * The list memory is also released by g_list_free(). If LIST is NULL it
1.11 * simply returns.
1.12 *
1.13 * @param list the GList containing a list of GMythChannelInfo to free.
1.14 */
1.15 void
1.16 -gmyth_free_channel_list(GList *list)
1.17 +gmyth_free_channel_list (GList *list)
1.18 {
1.19 - if (list == NULL) {
1.20 - g_warning ("%s received null GList as parameter", __FUNCTION__);
1.21 - return;
1.22 - }
1.23 + g_return_if_fail (list != NULL);
1.24
1.25 - g_list_foreach (list, free_channel_data, NULL);
1.26 -
1.27 - g_list_free (list);
1.28 + g_list_foreach (list, free_channel_data, NULL);
1.29 + g_list_free (list);
1.30 }
1.31
1.32 -/** Frees the memory allocated to the GMythProgramInfo objects inside list.
1.33 +/**
1.34 + * Frees the memory allocated to the GMythProgramInfo objects inside list.
1.35 * The list memory is also released by g_list_free(). If list is NULL it
1.36 * simply returns.
1.37 *
1.38 @@ -64,61 +62,63 @@
1.39 void
1.40 gmyth_free_program_list(GList *list)
1.41 {
1.42 - if (list == NULL) {
1.43 - g_warning ("%s received null GList as parameter", __FUNCTION__);
1.44 - return;
1.45 - }
1.46 + g_return_if_fail (list != NULL);
1.47
1.48 - g_list_foreach (list, free_program_data, NULL);
1.49 -
1.50 - g_list_free (list);
1.51 + g_list_foreach (list, free_program_data, NULL);
1.52 + g_list_free (list);
1.53 }
1.54
1.55 +#ifdef GMYTH_USE_DEBUG
1.56 +/**
1.57 + * Prints the channel info to the standard output. The gmyth debug must be enabled.
1.58 + * @param channel_info the GMythChannelInfo instance
1.59 + */
1.60 void
1.61 -gmyth_channel_info_print(GMythChannelInfo *channel_info)
1.62 +gmyth_channel_info_print (GMythChannelInfo *channel_info)
1.63 {
1.64 - if ( channel_info != NULL )
1.65 - {
1.66 - gmyth_debug("ChannelInfo (Name, Num, ID) = (%s, %s, %d)\n",
1.67 + if ( channel_info != NULL ) {
1.68 + gmyth_debug("ChannelInfo (Name, Num, ID) = (%s, %s, %d)\n",
1.69 channel_info->channel_name->str, channel_info->channel_num->str,
1.70 channel_info->channel_ID);
1.71 - }
1.72 + }
1.73 }
1.74
1.75 +/**
1.76 + * Prints the program info to the standard output. The gmyth debug must be enabled.
1.77 + * @param channel_info the GMythProgramInfo instance
1.78 + */
1.79 void
1.80 gmyth_program_info_print(GMythProgramInfo *program_info)
1.81 {
1.82 -
1.83 - if ( program_info != NULL ) {
1.84 -
1.85 - gmyth_debug( "ProgramInfo\n\tTitle = %s\n\t"
1.86 - "Description = %s\n\t"
1.87 - "Start time= %s\t"
1.88 - "End time = %s\n"
1.89 - "Path name = %s\n"
1.90 - "File size = %lld\n"
1.91 - , program_info->title->str,
1.92 - program_info->description->str,
1.93 - gmyth_util_time_to_string_from_time_val(program_info->startts),
1.94 - gmyth_util_time_to_string_from_time_val(program_info->endts),
1.95 - program_info->pathname->str,
1.96 - program_info->filesize );
1.97 -
1.98 - }
1.99 -
1.100 + g_return_if_fail (program_info);
1.101 +
1.102 + gmyth_debug( "ProgramInfo\n\tTitle = %s\n\t"
1.103 + "Description = %s\n\t"
1.104 + "Start time= %s\t"
1.105 + "End time = %s\n"
1.106 + "Path name = %s\n"
1.107 + "File size = %lld\n",
1.108 + program_info->title->str,
1.109 + program_info->description->str,
1.110 + gmyth_util_time_to_string_from_time_val(program_info->startts),
1.111 + gmyth_util_time_to_string_from_time_val(program_info->endts),
1.112 + program_info->pathname->str,
1.113 + program_info->filesize );
1.114 }
1.115 +#endif
1.116
1.117 static void
1.118 -free_channel_data(gpointer data, gpointer user_data)
1.119 +free_channel_data (gpointer data, gpointer user_data)
1.120 {
1.121 - if(data)
1.122 - g_free((GMythChannelInfo*) data);
1.123 + // Frees the GMythChannelInfo structure
1.124 + g_free(data);
1.125 }
1.126
1.127 static void
1.128 free_program_data(gpointer data, gpointer user_data)
1.129 {
1.130 - if(data)
1.131 - g_object_unref((GMythProgramInfo*) data);
1.132 + g_return_if_fail (data != NULL);
1.133 +
1.134 + g_object_unref((GMythProgramInfo*) data);
1.135 }
1.136