Re: [PATCH 4/6] Use readvars_parse_file() in loader/modules.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/22/2010 02:15 PM, David Cantrell wrote:

> +    gpointer key = NULL, value = NULL;
> +    GHashTable *cmdline = readvars_parse_file("/proc/cmdline");
>  
> -    if (options == NULL) {
> +    if (cmdline == NULL) {
>          return _writeModulesConf(MODULES_CONF);
>      }
>  
> -    while (options[i] != NULL) {
> -        gchar *tmpmod = NULL;
> -        gchar **fields = NULL;
> +    g_hash_table_iter_init(&iter, cmdline);
>  
> -        if (g_strstr_len(options[i], -1, "=") == NULL) {
> -            i++;
> -            continue;
> -        }
> +    while (g_hash_table_iter_next(&iter, &key, &value)) {
> +        gchar *k = (gchar *) key;
> +        gchar *v = (gchar *) value;
>  

Should key and value be free'd at the end of the while loop? I'm not
sure what glib is doing to alloc these internally, and the docs aren't
clear as to what to do with the returned pointers when you're done with
them.


- -- 
Brian C. Lane <bcl@xxxxxxxxxx>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBTEjbwhF+jBaO/jp/AQJQfAf/cXdHgyqCo5HsmsnqAoneVsrho6t+J3h6
ADz6kMkjaX9E9A4Il2DIwbaoj/zZd2kPLk6eqgcuVXzk1P8tSk/rm3pYnzDCQbLQ
3D1cWLfe3QzhxBuNZUTH80d4CWyC6dmJSh8Muh4pfUeE4mrpFOR1XsBJsT761wrS
d8Rsvlr7tZVYpTk4ineJPtSvCp+cHwnYKzRDFqPtGbhmmbGCDKRS6Uy5EBmGGrjf
AjKztcD00iWchZf7p7+NsMlhsU3n5rkrJBBDRxXQ8lWYMJ+8O7ZZe0wouuUpWiFw
FT85hjrpFaRfzdPIgmLczYLQ9iWJM3LLWC0PNxIU53c1sD1Re9o5wQ==
=5wp9
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux