Merge lp:~robert-ancell/lightdm/g-hash-keys into lp:lightdm

Proposed by Robert Ancell
Status: Merged
Approved by: Robert Ancell
Approved revision: 1923
Merged at revision: 1926
Proposed branch: lp:~robert-ancell/lightdm/g-hash-keys
Merge into: lp:lightdm
Diff against target: 28 lines (+7/-2)
1 file modified
src/process.c (+7/-2)
To merge this branch: bzr merge lp:~robert-ancell/lightdm/g-hash-keys
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Robert Ancell Approve
Review via email: mp+210494@code.launchpad.net

Commit message

Don't use g_hash_table_get_keys_as_array, it's a glib 2.40 feature

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/process.c'
2--- src/process.c 2014-03-06 22:34:35 +0000
3+++ src/process.c 2014-03-11 20:31:01 +0000
4@@ -177,6 +177,7 @@
5 gchar **argv;
6 gchar **env_keys, **env_values;
7 guint i, env_length;
8+ GList *link;
9 pid_t pid;
10 int log_fd = -1;
11 GError *error = NULL;
12@@ -207,10 +208,14 @@
13 }
14
15 /* Work out variables to set */
16- env_keys = (gchar **) g_hash_table_get_keys_as_array (process->priv->env, &env_length);
17+ env_length = g_hash_table_size (process->priv->env);
18+ env_keys = g_malloc (sizeof (gchar *) * env_length);
19 env_values = g_malloc (sizeof (gchar *) * env_length);
20- for (i = 0; i < env_length; i++)
21+ for (i = 0, link = g_hash_table_get_keys (process->priv->env); i < env_length; i++, link = link->next)
22+ {
23+ env_keys[i] = link->data;
24 env_values[i] = g_hash_table_lookup (process->priv->env, env_keys[i]);
25+ }
26
27 pid = fork ();
28 if (pid == 0)

Subscribers

People subscribed via source and target branches