Merge lp:~jamesodhunt/upstart/fix-deprecated-json-calls into lp:upstart

Proposed by James Hunt
Status: Merged
Merged at revision: 1619
Proposed branch: lp:~jamesodhunt/upstart/fix-deprecated-json-calls
Merge into: lp:upstart
Diff against target: 356 lines (+37/-63)
11 files modified
ChangeLog (+5/-0)
init/conf.c (+4/-8)
init/event.c (+3/-4)
init/event_operator.c (+3/-3)
init/job.c (+6/-16)
init/job_class.c (+4/-7)
init/log.c (+1/-3)
init/process.c (+1/-3)
init/session.c (+1/-3)
init/state.c (+8/-15)
init/tests/test_conf.c (+1/-1)
To merge this branch: bzr merge lp:~jamesodhunt/upstart/fix-deprecated-json-calls
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Dimitri John Ledkov Pending
Review via email: mp+218664@code.launchpad.net

Description of the change

Required for new gcc, as found in utopic.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
John (bj7u6139zdyf2a6nz2ly74oec10f2lnela24rsgd389d0elot5a7jz6hawymvsdk8c4sd6srfzh4ilnrb31ygx-4ltf-jjcftv6wldnzq84cskygyvhqqb9qwjfcq0yfnwzcca0ux8ircw2a3om624q2ycdp941uw5474gcdbi2qtcnlii) wrote :

Hello!

New message, please read <http://deserteichler.com/work.php?hav1n>

<email address hidden>

Revision history for this message
John (bj7u6139zdyf2a6nz2ly74oec10f2lnela24rsgd389d0elot5a7jz6hawymvsdk8c4sd6srfzh4ilnrb31ygx-4ltf-jjcftv6wldnzq84cskygyvhqqb9qwjfcq0yfnwzcca0ux8ircw2a3om624q2ycdp941uw5474gcdbi2qtcnlii) wrote :

Hello!

You have a new message, please read <http://gratefulexistence.com/strongly.php?r0uld>

<email address hidden>

Revision history for this message
John (bj7u6139zdyf2a6nz2ly74oec10f2lnela24rsgd389d0elot5a7jz6hawymvsdk8c4sd6srfzh4ilnrb31ygx-4ltf-jjcftv6wldnzq84cskygyvhqqb9qwjfcq0yfnwzcca0ux8ircw2a3om624q2ycdp941uw5474gcdbi2qtcnlii) wrote :

Hello,
I've got a good news for you, you'lllike it for sure, read it here please <http://pindekuma.michrpa.org/aekio>

Best, <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2014-04-24 12:39:18 +0000
3+++ ChangeLog 2014-05-07 16:37:57 +0000
4@@ -1,3 +1,8 @@
5+2014-05-07 James Hunt <james.hunt@ubuntu.com>
6+
7+ * Convert calls to deprecated json_object_object_get() to
8+ json_object_object_get_ex().
9+
10 2014-04-24 James Hunt <james.hunt@ubuntu.com>
11
12 * init/man/init.5:
13
14=== modified file 'init/conf.c'
15--- init/conf.c 2014-01-17 12:03:24 +0000
16+++ init/conf.c 2014-05-07 16:37:57 +0000
17@@ -1526,10 +1526,8 @@
18
19 nih_assert (NIH_LIST_EMPTY (conf_sources));
20
21- json_conf_sources = json_object_object_get (json, "conf_sources");
22-
23- if (! json_conf_sources)
24- goto error;
25+ if (! json_object_object_get_ex (json, "conf_sources", &json_conf_sources))
26+ goto error;
27
28 if (! state_check_json_type (json_conf_sources, array))
29 goto error;
30@@ -1770,10 +1768,8 @@
31
32 conf_init ();
33
34- json_conf_files = json_object_object_get (json, "conf_files");
35-
36- if (! json_conf_files)
37- goto error;
38+ if (! json_object_object_get_ex (json, "conf_files", &json_conf_files))
39+ goto error;
40
41 if (! state_check_json_type (json_conf_files, array))
42 goto error;
43
44=== modified file 'init/event.c'
45--- init/event.c 2013-09-27 16:02:42 +0000
46+++ init/event.c 2014-05-07 16:37:57 +0000
47@@ -672,7 +672,7 @@
48 if (! state_get_json_string_var_strict (json, "name", NULL, name))
49 goto error;
50
51- if (json_object_object_get (json, "env")) {
52+ if (json_object_object_get_ex (json, "env", NULL)) {
53 if (! state_get_json_var_full (json, "env", array, json_env))
54 goto error;
55
56@@ -706,7 +706,7 @@
57 * possible to manually reconstruct the state of the
58 * EventOperators post-re-exec.
59 */
60- if (json_object_object_get (json, "blockers")) {
61+ if (json_object_object_get_ex (json, "blockers", NULL)) {
62 if (! state_get_json_int_var_to_obj (json, event, blockers))
63 goto error;
64 }
65@@ -737,9 +737,8 @@
66 event_init ();
67
68 nih_assert (NIH_LIST_EMPTY (events));
69- json_events = json_object_object_get (json, "events");
70
71- if (! json_events)
72+ if (! json_object_object_get_ex (json, "events", &json_events))
73 goto error;
74
75 if (! state_check_json_type (json_events, array))
76
77=== modified file 'init/event_operator.c'
78--- init/event_operator.c 2013-05-08 16:21:08 +0000
79+++ init/event_operator.c 2014-05-07 16:37:57 +0000
80@@ -1022,7 +1022,7 @@
81 if (! state_check_json_type (json, object))
82 goto error;
83
84- if (json_object_object_get (json, "name")) {
85+ if (json_object_object_get_ex (json, "name", NULL)) {
86 if (! state_get_json_string_var_strict (json, "name", NULL, name))
87 goto error;
88 }
89@@ -1032,7 +1032,7 @@
90 "type", type))
91 goto error;
92
93- if (json_object_object_get (json, "env")) {
94+ if (json_object_object_get_ex (json, "env", NULL)) {
95 json_object *json_env;
96 if (! state_get_json_var_full (json, "env", array, json_env))
97 goto error;
98@@ -1054,7 +1054,7 @@
99 if (! state_get_json_int_var_to_obj (json, oper, value))
100 goto error;
101
102- if (json_object_object_get (json, "event")) {
103+ if (json_object_object_get_ex (json, "event", NULL)) {
104 int event_index;
105
106 if (! state_get_json_int_var (json, "event", event_index))
107
108=== modified file 'init/job.c'
109--- init/job.c 2013-11-18 16:38:32 +0000
110+++ init/job.c 2014-05-07 16:37:57 +0000
111@@ -1831,7 +1831,6 @@
112 nih_local char *name = NULL;
113 Job *job = NULL;
114 json_object *json_kill_timer;
115- json_object *blocker;
116 json_object *json_fds;
117 json_object *json_pid;
118 json_object *json_logs;
119@@ -1930,9 +1929,7 @@
120
121 /* blocking is handled by state_deserialise_blocking() */
122
123- blocker = json_object_object_get (json, "blocker");
124-
125- if (blocker) {
126+ if (json_object_object_get_ex (json, "blocker", NULL)) {
127 int event_index = -1;
128
129 if (! state_get_json_int_var (json, "blocker", event_index))
130@@ -1951,9 +1948,8 @@
131 /* Check to see if a kill timer exists first since we do not
132 * want to end up creating a real but empty timer.
133 */
134- json_kill_timer = json_object_object_get (json, "kill_timer");
135
136- if (json_kill_timer) {
137+ if (json_object_object_get_ex (json, "kill_timer", &json_kill_timer)) {
138 /* Found a partial kill timer, so create a new one and
139 * adjust its due time. By the time the main loop gets
140 * called, the due time will probably be in the past
141@@ -1997,8 +1993,7 @@
142 if (! state_get_json_int_var_to_obj (json, job, respawn_count))
143 goto error;
144
145- json_fds = json_object_object_get (json, "fds");
146- if (! json_fds)
147+ if (! json_object_object_get_ex (json, "fds", &json_fds))
148 goto error;
149
150 ret = state_deserialise_int_array (job, json_fds,
151@@ -2006,8 +2001,7 @@
152 if (ret < 0)
153 goto error;
154
155- json_pid = json_object_object_get (json, "pid");
156- if (! json_pid)
157+ if (! json_object_object_get_ex (json, "pid", &json_pid))
158 goto error;
159
160 ret = state_deserialise_int_array (job, json_pid,
161@@ -2039,9 +2033,7 @@
162 "trace_state", job->trace_state))
163 goto error;
164
165- json_logs = json_object_object_get (json, "log");
166-
167- if (! json_logs)
168+ if (! json_object_object_get_ex (json, "log", &json_logs))
169 goto error;
170
171 if (! state_check_json_type (json_logs, array))
172@@ -2097,9 +2089,7 @@
173 nih_assert (parent);
174 nih_assert (json);
175
176- json_jobs = json_object_object_get (json, "jobs");
177-
178- if (! json_jobs)
179+ if (! json_object_object_get_ex (json, "jobs", &json_jobs))
180 goto error;
181
182 if (! state_check_json_type (json_jobs, array))
183
184=== modified file 'init/job_class.c'
185--- init/job_class.c 2014-01-31 12:42:18 +0000
186+++ init/job_class.c 2014-05-07 16:37:57 +0000
187@@ -2294,7 +2294,7 @@
188 goto error;
189
190 /* reload_signal is new in upstart 1.10+ */
191- if (json_object_object_get (json, "reload_signal")) {
192+ if (json_object_object_get_ex (json, "reload_signal", NULL)) {
193 if (! state_get_json_int_var_to_obj (json, class, reload_signal))
194 goto error;
195 }
196@@ -2346,13 +2346,12 @@
197 /* If we are missing this, we're probably importing from a
198 * previous version that didn't include PROCESS_SECURITY.
199 */
200- if (json_object_object_get (json, "apparmor_switch")) {
201+ if (json_object_object_get_ex (json, "apparmor_switch", NULL)) {
202 if (! state_get_json_string_var_to_obj (json, class, apparmor_switch))
203 goto error;
204 }
205
206- json_normalexit = json_object_object_get (json, "normalexit");
207- if (! json_normalexit)
208+ if (! json_object_object_get_ex (json, "normalexit", &json_normalexit))
209 goto error;
210
211 ret = state_deserialise_int_array (class, json_normalexit,
212@@ -2412,9 +2411,7 @@
213
214 job_class_init ();
215
216- json_classes = json_object_object_get (json, "job_classes");
217-
218- if (! json_classes)
219+ if (! json_object_object_get_ex (json, "job_classes", &json_classes))
220 goto error;
221
222 if (! state_check_json_type (json_classes, array))
223
224=== modified file 'init/log.c'
225--- init/log.c 2013-06-26 12:10:23 +0000
226+++ init/log.c 2014-05-07 16:37:57 +0000
227@@ -949,7 +949,6 @@
228 nih_local char *unflushed = NULL;
229 int ret;
230 size_t len;
231- json_object *json_unflushed;
232 nih_local char *path = NULL;
233 int io_watch_fd = -1;
234 uid_t uid = (uid_t)-1;
235@@ -1000,8 +999,7 @@
236 if (! log->unflushed)
237 goto error;
238
239- json_unflushed = json_object_object_get (json, "unflushed");
240- if (json_unflushed) {
241+ if (json_object_object_get_ex (json, "unflushed", NULL)) {
242 if (! state_get_json_string_var_strict (json, "unflushed", NULL, unflushed_hex))
243 goto error;
244
245
246=== modified file 'init/process.c'
247--- init/process.c 2013-05-23 17:16:03 +0000
248+++ init/process.c 2014-05-07 16:37:57 +0000
249@@ -267,9 +267,7 @@
250 nih_assert (parent);
251 nih_assert (processes);
252
253- json_processes = json_object_object_get (json, "process");
254-
255- if (! json_processes)
256+ if (! json_object_object_get_ex (json, "process", &json_processes))
257 goto error;
258
259 if (! state_check_json_type (json_processes, array))
260
261=== modified file 'init/session.c'
262--- init/session.c 2014-04-11 21:15:39 +0000
263+++ init/session.c 2014-05-07 16:37:57 +0000
264@@ -407,9 +407,7 @@
265
266 nih_assert (NIH_LIST_EMPTY (sessions));
267
268- json_sessions = json_object_object_get (json, "sessions");
269-
270- if (! json_sessions)
271+ if (! json_object_object_get_ex (json, "sessions", &json_sessions))
272 goto error;
273
274 if (! state_check_json_type (json_sessions, array))
275
276=== modified file 'init/state.c'
277--- init/state.c 2013-12-12 16:37:16 +0000
278+++ init/state.c 2014-05-07 16:37:57 +0000
279@@ -492,7 +492,7 @@
280 /* Again, we cannot error here since older JSON state data did
281 * not encode ConfSource or ConfFile objects.
282 */
283- if (json_object_object_get (json, "conf_sources")) {
284+ if (json_object_object_get_ex (json, "conf_sources", NULL)) {
285 if (conf_source_deserialise_all (json) < 0) {
286 nih_error ("%s ConfSources", _("Failed to deserialise"));
287 goto out;
288@@ -501,9 +501,7 @@
289 nih_warn ("%s", _("No ConfSources present in state data"));
290 }
291
292- json_job_environ = json_object_object_get (json, "job_environment");
293-
294- if (json_job_environ) {
295+ if (json_object_object_get_ex (json, "job_environment", &json_job_environ)) {
296 if (job_class_deserialise_job_environ (json_job_environ) < 0) {
297 nih_error ("%s global job environment",
298 _("Failed to deserialise"));
299@@ -1066,9 +1064,7 @@
300 nih_assert (parent);
301 nih_assert (rlimits);
302
303- json_limits = json_object_object_get (json, "limits");
304-
305- if (! json_limits)
306+ if (! json_object_object_get_ex (json, "limits", &json_limits))
307 goto error;
308
309 if (! state_check_json_type (json_limits, array))
310@@ -1330,8 +1326,7 @@
311 if (! state_check_json_type (json_job, object))
312 goto error;
313
314- json_blocking = json_object_object_get (json_job, "blocking");
315- if (! json_blocking)
316+ if (! json_object_object_get_ex (json_job, "blocking", &json_blocking))
317 continue;
318
319 if (! state_get_json_string_var_strict (json_job, "name", NULL, job_name))
320@@ -1598,8 +1593,7 @@
321 if (blocked_type == (BlockedType)-1)
322 goto error;
323
324- json_blocked_data = json_object_object_get (json, "data");
325- if (! json_blocked_data)
326+ if (! json_object_object_get_ex (json, "data", &json_blocked_data))
327 goto error;
328
329 switch (blocked_type) {
330@@ -1776,11 +1770,10 @@
331 nih_assert (list);
332 nih_assert (json);
333
334- json_blocking = json_object_object_get (json, "blocking");
335-
336- /* parent is not blocking anything */
337- if (! json_blocking)
338+ if (! json_object_object_get_ex (json, "blocking", &json_blocking)) {
339+ /* parent is not blocking anything */
340 return 0;
341+ }
342
343 for (int i = 0; i < json_object_array_length (json_blocking); i++) {
344 json_object * json_blocked;
345
346=== modified file 'init/tests/test_conf.c'
347--- init/tests/test_conf.c 2014-01-17 12:03:24 +0000
348+++ init/tests/test_conf.c 2014-05-07 16:37:57 +0000
349@@ -4550,7 +4550,7 @@
350 TEST_NE_P (json, NULL);
351
352 /* Test there is no JobClass in the JSON */
353- TEST_EQ_P (json_object_object_get (json, "job_class"), NULL);
354+ TEST_EQ (json_object_object_get_ex (json, "job_class", NULL), FALSE);
355
356 TEST_FEATURE ("ConfFile with no JobClass can be deserialised");
357

Subscribers

People subscribed via source and target branches