[easytag] Simplify ET_Set_Field_File_Tag_Item()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Simplify ET_Set_Field_File_Tag_Item()
- Date: Sun, 28 Dec 2014 16:07:10 +0000 (UTC)
commit ef551ae59259c5782a005b532716832c92458162
Author: David King <amigadave amigadave com>
Date: Sun Dec 28 15:04:57 2014 +0000
Simplify ET_Set_Field_File_Tag_Item()
Return void rather than TRUE. Use a comparison against '\0' rather than
using g_utf8_strlen(). Avoid a superfluous assignment to NULL.
src/et_core.c | 18 +++++++++---------
src/et_core.h | 2 +-
2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/et_core.c b/src/et_core.c
index f1ca3fa..23d3d75 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -2772,25 +2772,25 @@ ET_Set_Filename_File_Name_Item (File_Name *FileName,
* Set the value of a field of a FileTag item (for ex, value of FileTag->title)
* Must be used only for the 'gchar *' components
*/
-gboolean ET_Set_Field_File_Tag_Item (gchar **FileTagField, const gchar *value)
+void
+ET_Set_Field_File_Tag_Item (gchar **FileTagField,
+ const gchar *value)
{
- g_return_val_if_fail (FileTagField != NULL, FALSE);
+ g_return_if_fail (FileTagField != NULL);
if (*FileTagField != NULL)
{
- g_free(*FileTagField);
+ g_free (*FileTagField);
*FileTagField = NULL;
}
if (value != NULL)
{
- if (g_utf8_strlen(value, -1) > 0)
- *FileTagField = g_strdup(value);
- else
- *FileTagField = NULL;
+ if (*value != '\0')
+ {
+ *FileTagField = g_strdup (value);
+ }
}
-
- return TRUE;
}
diff --git a/src/et_core.h b/src/et_core.h
index e72b2b9..810b1c6 100644
--- a/src/et_core.h
+++ b/src/et_core.h
@@ -297,7 +297,7 @@ void ET_Free_File_List_Item (ET_File *ETFile);
gboolean ET_Copy_File_Tag_Item (const ET_File *ETFile, File_Tag *FileTag);
gboolean ET_Set_Field_File_Name_Item (gchar **FileNameField, gchar *value);
gboolean ET_Set_Filename_File_Name_Item (File_Name *FileName, const gchar *filename_utf8, const gchar
*filename);
-gboolean ET_Set_Field_File_Tag_Item (gchar **FileTagField, const gchar *value);
+void ET_Set_Field_File_Tag_Item (gchar **FileTagField, const gchar *value);
void et_file_tag_set_picture (File_Tag *file_tag, const EtPicture *pic);
GList *ET_Displayed_File_List_First (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]