[packagekit] pk-glib2 problem

Daniel Nicoletti dantti85-pk at yahoo.com.br
Wed Sep 16 10:09:06 PDT 2009


> > also as there is not package_id_free
> > is this ok?
> >
> > gchar *pi;
> > pi = package_ids[i];
> > delete pi;
> 
> No, delete is a C++ thing, and the memory is allocated using C. You
> need to use g_strfreev() on arrays you've created yourself.

hmm, I also don't like this new behavior :P,means more lines of code...
Will this will leak right?
FindPkg( pk_package_id_split(pi)[PK_PACKAGE_ID_NAME] );

instead i should:
gchar **parts;
parts = pk_package_id_split (package->priv->id);
FindPkg( parts[PK_PACKAGE_ID_NAME] );
g_strfreev (parts);

right?
can't we have a more  convenient function to get name, version instead?

using p->name imo was much easier...

Daniel.


----- Mensagem original ----
> De: Richard Hughes <hughsient at gmail.com>
> Para: PackageKit users and developers list <packagekit at lists.freedesktop.org>
> Enviadas: Terça-feira, 15 de Setembro de 2009 4:59:03
> Assunto: Re: [packagekit] pk-glib2 problem
> 
> 2009/9/14 Daniel Nicoletti :
> > in resolve I need to know if there is a package version
> > provided:
> > if (pk_package_id_split(pi)[PK_PACKAGE_ID_VERSION] == NULL) {
> 
> You need to either use:
> 
> if (pk_package_id_split(pi) != NULL)
> or
> if (pk_package_id_check(pi) == TRUE)
> 
> > This segfaults...
> > also as there is not package_id_free
> > is this ok?
> >
> > gchar *pi;
> > pi = package_ids[i];
> > delete pi;
> 
> No, delete is a C++ thing, and the memory is allocated using C. You
> need to use g_strfreev() on arrays you've created yourself.
> 
> Richard.
> _______________________________________________
> PackageKit mailing list
> PackageKit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/packagekit



      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com



More information about the PackageKit mailing list