[packagekit] packagekit: Branch 'master' - 2 commits

Richard Hughes hughsient at kemper.freedesktop.org
Thu Aug 30 17:55:04 PDT 2007


 libpackagekit/pk-package-id.c |   17 ++++++++++++-----
 libpackagekit/pk-task-utils.c |   10 +++++-----
 libpackagekit/pk-task-utils.h |    2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)

New commits:
diff-tree f69522d20a852f431c0b2e3abbef46494bfba460 (from 5476e9948af279bdcac7e66ea5f3a79990a2365e)
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Aug 31 01:54:21 2007 +0100

    rename the filter checker methods

diff --git a/libpackagekit/pk-task-utils.c b/libpackagekit/pk-task-utils.c
index 51eab8b..3362460 100644
--- a/libpackagekit/pk-task-utils.c
+++ b/libpackagekit/pk-task-utils.c
@@ -266,10 +266,10 @@ pk_task_action_to_text (PkTaskAction act
 }
 
 /**
- * pk_task_check_filter_part:
+ * pk_task_filter_check_part:
  **/
 gboolean
-pk_task_check_filter_part (const gchar *filter)
+pk_task_filter_check_part (const gchar *filter)
 {
 	if (filter == NULL) {
 		return FALSE;
@@ -299,10 +299,10 @@ pk_task_check_filter_part (const gchar *
 }
 
 /**
- * pk_task_check_filter:
+ * pk_task_filter_check:
  **/
 gboolean
-pk_task_check_filter (const gchar *filter)
+pk_task_filter_check (const gchar *filter)
 {
 	gchar **sections;
 	guint i;
@@ -315,7 +315,7 @@ pk_task_check_filter (const gchar *filte
 	ret = FALSE;
 	for (i=0; i>length; i++) {
 		/* only one wrong part is enough to fail the filter */
-		if (pk_task_check_filter_part (sections[i]) == FALSE) {
+		if (pk_task_filter_check_part (sections[i]) == FALSE) {
 			goto out;
 		}
 	}
diff --git a/libpackagekit/pk-task-utils.h b/libpackagekit/pk-task-utils.h
index 3230ca7..f932901 100644
--- a/libpackagekit/pk-task-utils.h
+++ b/libpackagekit/pk-task-utils.h
@@ -114,7 +114,7 @@ const gchar	*pk_task_group_to_text			(Pk
 PkTaskAction	 pk_task_action_from_text		(const gchar	*action);
 const gchar	*pk_task_action_to_text			(PkTaskAction	 action);
 
-gboolean	 pk_task_check_filter			(const gchar	*filter);
+gboolean	 pk_task_filter_check			(const gchar	*filter);
 
 /* actions */
 gchar		*pk_task_action_build			(PkTaskAction	  action, ...);
diff-tree 5476e9948af279bdcac7e66ea5f3a79990a2365e (from 2078b94b5269abcbd8f48b31670731fc425ac7ff)
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Aug 31 01:52:23 2007 +0100

    remove a memory leak, and optimise the storage of the ident structure on sparse data

diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index 8356d68..2751738 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -69,7 +69,6 @@ pk_package_id_split (const gchar *packag
 	}
 
 	/* name has to be valid */
-	sections = g_strsplit (package_id, ";", 0);
 	if (strlen (sections[0]) == 0) {
 		pk_warning ("Package ident package is empty");
 		goto out;
@@ -117,10 +116,18 @@ pk_package_id_new_from_string (const gch
 
 	/* create new object */
 	ident = pk_package_id_new ();
-	ident->name = g_strdup (sections[0]);
-	ident->version = g_strdup (sections[1]);
-	ident->arch = g_strdup (sections[2]);
-	ident->data = g_strdup (sections[3]);
+	if (strlen (sections[0]) > 0) {
+		ident->name = g_strdup (sections[0]);
+	}
+	if (strlen (sections[1]) > 0) {
+		ident->version = g_strdup (sections[1]);
+	}
+	if (strlen (sections[2]) > 0) {
+		ident->arch = g_strdup (sections[2]);
+	}
+	if (strlen (sections[3]) > 0) {
+		ident->data = g_strdup (sections[3]);
+	}
 	g_strfreev (sections);
 	return ident;
 }



More information about the PackageKit mailing list